[Python-modules-commits] [pychromecast] 01/15: Increased Windows Compatibility

Ruben Undheim rubund-guest at moszumanska.debian.org
Sat Sep 12 12:30:55 UTC 2015


This is an automated email from the git hooks/post-receive script.

rubund-guest pushed a commit to branch master
in repository pychromecast.

commit 34085e435e596b703e001239add1f80ab072caec
Author: Ryan Kraus <rmkraus at gmail.com>
Date:   Wed Jul 15 23:13:35 2015 -0400

    Increased Windows Compatibility
    
    Windows protobuf descriptors don’t seem to accept the syntax argument.
    Removing it seems to cause to issues. This update will remove the
    syntax argument if it is not present in the FileDescriptor. It will
    assume that if the syntax argument is not in one, then it is not any of
    the Descriptors.
---
 pychromecast/cast_channel_pb2.py | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/pychromecast/cast_channel_pb2.py b/pychromecast/cast_channel_pb2.py
index 1893718..40312db 100644
--- a/pychromecast/cast_channel_pb2.py
+++ b/pychromecast/cast_channel_pb2.py
@@ -1,8 +1,9 @@
 # Generated by the protocol buffer compiler.  DO NOT EDIT!
 # source: cast_channel.proto
 
+import inspect
 import sys
-_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
+_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode('latin1'))
 from google.protobuf.internal import enum_type_wrapper
 from google.protobuf import descriptor as _descriptor
 from google.protobuf import message as _message
@@ -14,14 +15,24 @@ from google.protobuf import descriptor_pb2
 _sym_db = _symbol_database.Default()
 
 
+if 'syntax' in inspect.getargspec(_descriptor.FileDescriptor.__init__).args:
+    def descriptor_abstractor(**kwargs):
+        """ Abstract the descriptor classes. Remove syntax. """
+        if 'syntax' in kwargs.keys():
+            kwargs.pop('syntax')
+        return kwargs
+else:
+    def descriptor_abstractor(**kwargs):
+        """ Abstract the descriptor classes. """
+        return kwargs
 
 
-DESCRIPTOR = _descriptor.FileDescriptor(
+DESCRIPTOR = _descriptor.FileDescriptor(**descriptor_abstractor(
   name='cast_channel.proto',
   package='extensions.core_api.cast_channel',
   syntax='proto2',
   serialized_pb=_b('\n\x12\x63\x61st_channel.proto\x12 extensions.core_api.cast_channel\"\xed\x02\n\x0b\x43\x61stMessage\x12W\n\x10protocol_version\x18\x01 \x02(\x0e\x32=.extensions.core_api.cast_channel.CastMessage.ProtocolVersion\x12\x11\n\tsource_id\x18\x02 \x02(\t\x12\x16\n\x0e\x64\x65stination_id\x18\x03 \x02(\t\x12\x11\n\tnamespace\x18\x04 \x02(\t\x12O\n\x0cpayload_type\x18\x05 \x02(\x0e\x32\x39.extensions.core_api.cast_channel.CastMessage.PayloadType\x12\x14\n\x0cpayload_utf8\x18\ [...]
-)
+))
 _sym_db.RegisterFileDescriptor(DESCRIPTOR)
 
 _SIGNATUREALGORITHM = _descriptor.EnumDescriptor(
@@ -123,7 +134,7 @@ _AUTHERROR_ERRORTYPE = _descriptor.EnumDescriptor(
 _sym_db.RegisterEnumDescriptor(_AUTHERROR_ERRORTYPE)
 
 
-_CASTMESSAGE = _descriptor.Descriptor(
+_CASTMESSAGE = _descriptor.Descriptor(**descriptor_abstractor(
   name='CastMessage',
   full_name='extensions.core_api.cast_channel.CastMessage',
   filename=None,
@@ -195,10 +206,10 @@ _CASTMESSAGE = _descriptor.Descriptor(
   ],
   serialized_start=57,
   serialized_end=422,
-)
+))
 
 
-_AUTHCHALLENGE = _descriptor.Descriptor(
+_AUTHCHALLENGE = _descriptor.Descriptor(**descriptor_abstractor(
   name='AuthChallenge',
   full_name='extensions.core_api.cast_channel.AuthChallenge',
   filename=None,
@@ -226,10 +237,10 @@ _AUTHCHALLENGE = _descriptor.Descriptor(
   ],
   serialized_start=424,
   serialized_end=539,
-)
+))
 
 
-_AUTHRESPONSE = _descriptor.Descriptor(
+_AUTHRESPONSE = _descriptor.Descriptor(**descriptor_abstractor(
   name='AuthResponse',
   full_name='extensions.core_api.cast_channel.AuthResponse',
   filename=None,
@@ -278,10 +289,10 @@ _AUTHRESPONSE = _descriptor.Descriptor(
   ],
   serialized_start=542,
   serialized_end=742,
-)
+))
 
 
-_AUTHERROR = _descriptor.Descriptor(
+_AUTHERROR = _descriptor.Descriptor(**descriptor_abstractor(
   name='AuthError',
   full_name='extensions.core_api.cast_channel.AuthError',
   filename=None,
@@ -310,10 +321,10 @@ _AUTHERROR = _descriptor.Descriptor(
   ],
   serialized_start=745,
   serialized_end=913,
-)
+))
 
 
-_DEVICEAUTHMESSAGE = _descriptor.Descriptor(
+_DEVICEAUTHMESSAGE = _descriptor.Descriptor(**descriptor_abstractor(
   name='DeviceAuthMessage',
   full_name='extensions.core_api.cast_channel.DeviceAuthMessage',
   filename=None,
@@ -355,7 +366,7 @@ _DEVICEAUTHMESSAGE = _descriptor.Descriptor(
   ],
   serialized_start=916,
   serialized_end=1129,
-)
+))
 
 _CASTMESSAGE.fields_by_name['protocol_version'].enum_type = _CASTMESSAGE_PROTOCOLVERSION
 _CASTMESSAGE.fields_by_name['payload_type'].enum_type = _CASTMESSAGE_PAYLOADTYPE

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pychromecast.git



More information about the Python-modules-commits mailing list