diff --git a/commit_queue.py b/commit_queue.py index 6f08b2e6c..91cb28e77 100755 --- a/commit_queue.py +++ b/commit_queue.py @@ -26,7 +26,7 @@ THIRD_PARTY_DIR = os.path.join(os.path.dirname(__file__), 'third_party') sys.path.insert(0, THIRD_PARTY_DIR) from cq_client import cq_pb2 -from google.protobuf import text_format +from protobuf26 import text_format def usage(more): def hook(fn): diff --git a/third_party/cq_client/cq_pb2.py b/third_party/cq_client/cq_pb2.py index 68c7e8cf0..ecfe9cf0e 100644 --- a/third_party/cq_client/cq_pb2.py +++ b/third_party/cq_client/cq_pb2.py @@ -1,13 +1,22 @@ +# This file was originally generated by the protocol buffer compiler 2.6.1, but +# was subsequently manually edited to import protobuf26 instead of +# google.protobuf. If you need to re-generate this file, please make similar +# changes again and add this comment back. More details on why we chose to +# rename the package can be found in the file +# depot_tools/third_party/protobuf26/README.chromium +# Example CL updating the references: +# https://codereview.chromium.org/1162993005/ + # Generated by the protocol buffer compiler. DO NOT EDIT! # source: cq.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database -from google.protobuf import descriptor_pb2 +from protobuf26 import descriptor as _descriptor +from protobuf26 import message as _message +from protobuf26 import reflection as _reflection +from protobuf26 import symbol_database as _symbol_database +from protobuf26 import descriptor_pb2 # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() diff --git a/third_party/google/__init__.py b/third_party/google/__init__.py deleted file mode 100644 index de40ea7ca..000000000 --- a/third_party/google/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) diff --git a/third_party/google/protobuf/README.chromium b/third_party/google/protobuf/README.chromium deleted file mode 100644 index 12b8af28a..000000000 --- a/third_party/google/protobuf/README.chromium +++ /dev/null @@ -1 +0,0 @@ -This directory contains google.protobuf module version 2.6.0 build 0. diff --git a/third_party/protobuf26/README.chromium b/third_party/protobuf26/README.chromium new file mode 100644 index 000000000..35df332a8 --- /dev/null +++ b/third_party/protobuf26/README.chromium @@ -0,0 +1,20 @@ +This directory contains google.protobuf module version 2.6.0 build 0. + +sergiyb@: It has been manually renamed to protobuf26. This is needed to avoid +conflicts with a built-in google.protobuf module found on many developer +machines. The long-term solution to this problem, however, should be virtualenv. +Unfortunately due to limited time and lack of experience, it was not a +reasonable short-term solution. + +If you need to update this package, please make sure that you replace all +the references to google.protobuf in the package itself with protobuf26, e.g. + + from google.protobuf import text_format + import google.protobuf + +becomes + + from protobuf26 import text_format + import protobuf26 + +Bug tracking setting up virtualenv for depot_tools is https://crbug.com/496241. diff --git a/third_party/google/protobuf/__init__.py b/third_party/protobuf26/__init__.py similarity index 100% rename from third_party/google/protobuf/__init__.py rename to third_party/protobuf26/__init__.py diff --git a/third_party/google/protobuf/compiler/__init__.py b/third_party/protobuf26/compiler/__init__.py similarity index 100% rename from third_party/google/protobuf/compiler/__init__.py rename to third_party/protobuf26/compiler/__init__.py diff --git a/third_party/google/protobuf/compiler/plugin_pb2.py b/third_party/protobuf26/compiler/plugin_pb2.py similarity index 95% rename from third_party/google/protobuf/compiler/plugin_pb2.py rename to third_party/protobuf26/compiler/plugin_pb2.py index 20ab06dea..806241d9a 100644 --- a/third_party/google/protobuf/compiler/plugin_pb2.py +++ b/third_party/protobuf26/compiler/plugin_pb2.py @@ -3,17 +3,17 @@ import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database -from google.protobuf import descriptor_pb2 +from protobuf26 import descriptor as _descriptor +from protobuf26 import message as _message +from protobuf26 import reflection as _reflection +from protobuf26 import symbol_database as _symbol_database +from protobuf26 import descriptor_pb2 # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() -import google.protobuf.descriptor_pb2 +import protobuf26.descriptor_pb2 DESCRIPTOR = _descriptor.FileDescriptor( diff --git a/third_party/google/protobuf/descriptor.py b/third_party/protobuf26/descriptor.py similarity index 99% rename from third_party/google/protobuf/descriptor.py rename to third_party/protobuf26/descriptor.py index 555498d5a..109a09d99 100644 --- a/third_party/google/protobuf/descriptor.py +++ b/third_party/protobuf26/descriptor.py @@ -38,7 +38,7 @@ file, in types that make this information accessible in Python. __author__ = 'robinson@google.com (Will Robinson)' -from google.protobuf.internal import api_implementation +from protobuf26.internal import api_implementation if api_implementation.Type() == 'cpp': @@ -47,9 +47,9 @@ if api_implementation.Type() == 'cpp': import uuid if api_implementation.Version() == 2: - from google.protobuf.pyext import _message + from protobuf26.pyext import _message else: - from google.protobuf.internal import cpp_message + from protobuf26.internal import cpp_message class Error(Exception): @@ -106,7 +106,7 @@ class DescriptorBase(object): """ if self._options: return self._options - from google.protobuf import descriptor_pb2 + from protobuf26 import descriptor_pb2 try: options_class = getattr(descriptor_pb2, self._options_class_name) except AttributeError: @@ -774,7 +774,7 @@ def MakeDescriptor(desc_proto, package='', build_file_if_cpp=True): # definition in the C++ descriptor pool. To do this, we build a # FileDescriptorProto with the same definition as this descriptor and build # it into the pool. - from google.protobuf import descriptor_pb2 + from protobuf26 import descriptor_pb2 file_descriptor_proto = descriptor_pb2.FileDescriptorProto() file_descriptor_proto.message_type.add().MergeFrom(desc_proto) diff --git a/third_party/google/protobuf/descriptor_database.py b/third_party/protobuf26/descriptor_database.py similarity index 100% rename from third_party/google/protobuf/descriptor_database.py rename to third_party/protobuf26/descriptor_database.py diff --git a/third_party/google/protobuf/descriptor_pb2.py b/third_party/protobuf26/descriptor_pb2.py similarity index 99% rename from third_party/google/protobuf/descriptor_pb2.py rename to third_party/protobuf26/descriptor_pb2.py index 808fd1789..ae81b36c8 100644 --- a/third_party/google/protobuf/descriptor_pb2.py +++ b/third_party/protobuf26/descriptor_pb2.py @@ -3,10 +3,10 @@ import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database +from protobuf26 import descriptor as _descriptor +from protobuf26 import message as _message +from protobuf26 import reflection as _reflection +from protobuf26 import symbol_database as _symbol_database # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() diff --git a/third_party/google/protobuf/descriptor_pool.py b/third_party/protobuf26/descriptor_pool.py similarity index 99% rename from third_party/google/protobuf/descriptor_pool.py rename to third_party/protobuf26/descriptor_pool.py index 372f458f5..882fd9f2c 100644 --- a/third_party/google/protobuf/descriptor_pool.py +++ b/third_party/protobuf26/descriptor_pool.py @@ -59,9 +59,9 @@ __author__ = 'matthewtoia@google.com (Matt Toia)' import sys -from google.protobuf import descriptor -from google.protobuf import descriptor_database -from google.protobuf import text_encoding +from protobuf26 import descriptor +from protobuf26 import descriptor_database +from protobuf26 import text_encoding def _NormalizeFullyQualifiedName(name): diff --git a/third_party/google/protobuf/internal/__init__.py b/third_party/protobuf26/internal/__init__.py similarity index 100% rename from third_party/google/protobuf/internal/__init__.py rename to third_party/protobuf26/internal/__init__.py diff --git a/third_party/google/protobuf/internal/api_implementation.py b/third_party/protobuf26/internal/api_implementation.py similarity index 98% rename from third_party/google/protobuf/internal/api_implementation.py rename to third_party/protobuf26/internal/api_implementation.py index cbb85747f..b5615d1bb 100644 --- a/third_party/google/protobuf/internal/api_implementation.py +++ b/third_party/protobuf26/internal/api_implementation.py @@ -36,7 +36,7 @@ import sys try: # pylint: disable=g-import-not-at-top - from google.protobuf.internal import _api_implementation + from protobuf26.internal import _api_implementation # The compile-time constants in the _api_implementation module can be used to # switch to a certain implementation of the Python API at build time. _api_version = _api_implementation.api_version diff --git a/third_party/google/protobuf/internal/containers.py b/third_party/protobuf26/internal/containers.py similarity index 100% rename from third_party/google/protobuf/internal/containers.py rename to third_party/protobuf26/internal/containers.py diff --git a/third_party/google/protobuf/internal/cpp_message.py b/third_party/protobuf26/internal/cpp_message.py similarity index 98% rename from third_party/google/protobuf/internal/cpp_message.py rename to third_party/protobuf26/internal/cpp_message.py index 8eb38ca47..1904a04ad 100644 --- a/third_party/google/protobuf/internal/cpp_message.py +++ b/third_party/protobuf26/internal/cpp_message.py @@ -36,9 +36,9 @@ __author__ = 'petar@google.com (Petar Petrov)' import copy_reg import operator -from google.protobuf.internal import _net_proto2___python -from google.protobuf.internal import enum_type_wrapper -from google.protobuf import message +from protobuf26.internal import _net_proto2___python +from protobuf26.internal import enum_type_wrapper +from protobuf26 import message _LABEL_REPEATED = _net_proto2___python.LABEL_REPEATED @@ -299,7 +299,7 @@ class ExtensionDict(object): self._values = {} def __setitem__(self, extension, value): - from google.protobuf import descriptor + from protobuf26 import descriptor if not isinstance(extension, descriptor.FieldDescriptor): raise KeyError('Bad extension %r.' % (extension,)) cdescriptor = extension._cdescriptor @@ -311,7 +311,7 @@ class ExtensionDict(object): self._values[extension] = value def __getitem__(self, extension): - from google.protobuf import descriptor + from protobuf26 import descriptor if not isinstance(extension, descriptor.FieldDescriptor): raise KeyError('Bad extension %r.' % (extension,)) @@ -329,7 +329,7 @@ class ExtensionDict(object): return ext def ClearExtension(self, extension): - from google.protobuf import descriptor + from protobuf26 import descriptor if not isinstance(extension, descriptor.FieldDescriptor): raise KeyError('Bad extension %r.' % (extension,)) self._cmsg.ClearFieldByDescriptor(extension._cdescriptor) @@ -337,7 +337,7 @@ class ExtensionDict(object): del self._values[extension] def HasExtension(self, extension): - from google.protobuf import descriptor + from protobuf26 import descriptor if not isinstance(extension, descriptor.FieldDescriptor): raise KeyError('Bad extension %r.' % (extension,)) return self._cmsg.HasFieldByDescriptor(extension._cdescriptor) @@ -627,7 +627,7 @@ def _AddMessageMethods(message_descriptor, cls): def __unicode__(self): # Lazy import to prevent circular import when text_format imports this file. - from google.protobuf import text_format + from protobuf26 import text_format return text_format.MessageToString(self, as_utf8=True).decode('utf-8') # Attach the local methods to the message class. diff --git a/third_party/google/protobuf/internal/decoder.py b/third_party/protobuf26/internal/decoder.py similarity index 99% rename from third_party/google/protobuf/internal/decoder.py rename to third_party/protobuf26/internal/decoder.py index 651ee0d4a..800f04b2d 100644 --- a/third_party/google/protobuf/internal/decoder.py +++ b/third_party/protobuf26/internal/decoder.py @@ -87,9 +87,9 @@ __author__ = 'kenton@google.com (Kenton Varda)' import struct import sys ##PY25 _PY2 = sys.version_info[0] < 3 ##PY25 -from google.protobuf.internal import encoder -from google.protobuf.internal import wire_format -from google.protobuf import message +from protobuf26.internal import encoder +from protobuf26.internal import wire_format +from protobuf26 import message # This will overflow and thus become IEEE-754 "infinity". We would use diff --git a/third_party/google/protobuf/internal/encoder.py b/third_party/protobuf26/internal/encoder.py similarity index 99% rename from third_party/google/protobuf/internal/encoder.py rename to third_party/protobuf26/internal/encoder.py index 0a7c04179..22b184143 100644 --- a/third_party/google/protobuf/internal/encoder.py +++ b/third_party/protobuf26/internal/encoder.py @@ -73,7 +73,7 @@ __author__ = 'kenton@google.com (Kenton Varda)' import struct import sys ##PY25 _PY2 = sys.version_info[0] < 3 ##PY25 -from google.protobuf.internal import wire_format +from protobuf26.internal import wire_format # This will overflow and thus become IEEE-754 "infinity". We would use diff --git a/third_party/google/protobuf/internal/enum_type_wrapper.py b/third_party/protobuf26/internal/enum_type_wrapper.py similarity index 100% rename from third_party/google/protobuf/internal/enum_type_wrapper.py rename to third_party/protobuf26/internal/enum_type_wrapper.py diff --git a/third_party/google/protobuf/internal/message_listener.py b/third_party/protobuf26/internal/message_listener.py similarity index 100% rename from third_party/google/protobuf/internal/message_listener.py rename to third_party/protobuf26/internal/message_listener.py diff --git a/third_party/google/protobuf/internal/python_message.py b/third_party/protobuf26/internal/python_message.py similarity index 98% rename from third_party/google/protobuf/internal/python_message.py rename to third_party/protobuf26/internal/python_message.py index 9ee352d6d..bbd0ea5df 100644 --- a/third_party/google/protobuf/internal/python_message.py +++ b/third_party/protobuf26/internal/python_message.py @@ -68,16 +68,16 @@ import struct import weakref # We use "as" to avoid name collisions with variables. -from google.protobuf.internal import containers -from google.protobuf.internal import decoder -from google.protobuf.internal import encoder -from google.protobuf.internal import enum_type_wrapper -from google.protobuf.internal import message_listener as message_listener_mod -from google.protobuf.internal import type_checkers -from google.protobuf.internal import wire_format -from google.protobuf import descriptor as descriptor_mod -from google.protobuf import message as message_mod -from google.protobuf import text_format +from protobuf26.internal import containers +from protobuf26.internal import decoder +from protobuf26.internal import encoder +from protobuf26.internal import enum_type_wrapper +from protobuf26.internal import message_listener as message_listener_mod +from protobuf26.internal import type_checkers +from protobuf26.internal import wire_format +from protobuf26 import descriptor as descriptor_mod +from protobuf26 import message as message_mod +from protobuf26 import text_format _FieldDescriptor = descriptor_mod.FieldDescriptor diff --git a/third_party/google/protobuf/internal/type_checkers.py b/third_party/protobuf26/internal/type_checkers.py similarity index 98% rename from third_party/google/protobuf/internal/type_checkers.py rename to third_party/protobuf26/internal/type_checkers.py index 8e1b3cc3c..779c09c9f 100644 --- a/third_party/google/protobuf/internal/type_checkers.py +++ b/third_party/protobuf26/internal/type_checkers.py @@ -51,11 +51,11 @@ __author__ = 'robinson@google.com (Will Robinson)' import sys ##PY25 if sys.version < '2.6': bytes = str ##PY25 -from google.protobuf.internal import api_implementation -from google.protobuf.internal import decoder -from google.protobuf.internal import encoder -from google.protobuf.internal import wire_format -from google.protobuf import descriptor +from protobuf26.internal import api_implementation +from protobuf26.internal import decoder +from protobuf26.internal import encoder +from protobuf26.internal import wire_format +from protobuf26 import descriptor _FieldDescriptor = descriptor.FieldDescriptor diff --git a/third_party/google/protobuf/internal/wire_format.py b/third_party/protobuf26/internal/wire_format.py similarity index 99% rename from third_party/google/protobuf/internal/wire_format.py rename to third_party/protobuf26/internal/wire_format.py index c941fe1a5..29961fd89 100644 --- a/third_party/google/protobuf/internal/wire_format.py +++ b/third_party/protobuf26/internal/wire_format.py @@ -33,8 +33,8 @@ __author__ = 'robinson@google.com (Will Robinson)' import struct -from google.protobuf import descriptor -from google.protobuf import message +from protobuf26 import descriptor +from protobuf26 import message TAG_TYPE_BITS = 3 # Number of bits used to hold type info in a proto tag. diff --git a/third_party/google/protobuf/message.py b/third_party/protobuf26/message.py similarity index 100% rename from third_party/google/protobuf/message.py rename to third_party/protobuf26/message.py diff --git a/third_party/google/protobuf/message_factory.py b/third_party/protobuf26/message_factory.py similarity index 97% rename from third_party/google/protobuf/message_factory.py rename to third_party/protobuf26/message_factory.py index 9004ffd9b..a8d63f7f3 100644 --- a/third_party/google/protobuf/message_factory.py +++ b/third_party/protobuf26/message_factory.py @@ -44,10 +44,10 @@ my_proto_instance = message_classes['some.proto.package.MessageName']() __author__ = 'matthewtoia@google.com (Matt Toia)' import sys ##PY25 -from google.protobuf import descriptor_database -from google.protobuf import descriptor_pool -from google.protobuf import message -from google.protobuf import reflection +from protobuf26 import descriptor_database +from protobuf26 import descriptor_pool +from protobuf26 import message +from protobuf26 import reflection class MessageFactory(object): diff --git a/third_party/google/protobuf/reflection.py b/third_party/protobuf26/reflection.py similarity index 96% rename from third_party/google/protobuf/reflection.py rename to third_party/protobuf26/reflection.py index 7aac62306..673348c90 100644 --- a/third_party/google/protobuf/reflection.py +++ b/third_party/protobuf26/reflection.py @@ -48,24 +48,24 @@ this file*. __author__ = 'robinson@google.com (Will Robinson)' -from google.protobuf.internal import api_implementation -from google.protobuf import descriptor as descriptor_mod -from google.protobuf import message +from protobuf26.internal import api_implementation +from protobuf26 import descriptor as descriptor_mod +from protobuf26 import message _FieldDescriptor = descriptor_mod.FieldDescriptor if api_implementation.Type() == 'cpp': if api_implementation.Version() == 2: - from google.protobuf.pyext import cpp_message + from protobuf26.pyext import cpp_message _NewMessage = cpp_message.NewMessage _InitMessage = cpp_message.InitMessage else: - from google.protobuf.internal import cpp_message + from protobuf26.internal import cpp_message _NewMessage = cpp_message.NewMessage _InitMessage = cpp_message.InitMessage else: - from google.protobuf.internal import python_message + from protobuf26.internal import python_message _NewMessage = python_message.NewMessage _InitMessage = python_message.InitMessage diff --git a/third_party/google/protobuf/service.py b/third_party/protobuf26/service.py similarity index 100% rename from third_party/google/protobuf/service.py rename to third_party/protobuf26/service.py diff --git a/third_party/google/protobuf/service_reflection.py b/third_party/protobuf26/service_reflection.py similarity index 100% rename from third_party/google/protobuf/service_reflection.py rename to third_party/protobuf26/service_reflection.py diff --git a/third_party/google/protobuf/symbol_database.py b/third_party/protobuf26/symbol_database.py similarity index 99% rename from third_party/google/protobuf/symbol_database.py rename to third_party/protobuf26/symbol_database.py index 7466fec50..bb586bd6b 100644 --- a/third_party/google/protobuf/symbol_database.py +++ b/third_party/protobuf26/symbol_database.py @@ -60,7 +60,7 @@ Example usage: """ -from google.protobuf import descriptor_pool +from protobuf26 import descriptor_pool class SymbolDatabase(object): diff --git a/third_party/google/protobuf/text_encoding.py b/third_party/protobuf26/text_encoding.py similarity index 100% rename from third_party/google/protobuf/text_encoding.py rename to third_party/protobuf26/text_encoding.py diff --git a/third_party/google/protobuf/text_format.py b/third_party/protobuf26/text_format.py similarity index 99% rename from third_party/google/protobuf/text_format.py rename to third_party/protobuf26/text_format.py index 50f76f228..6ef7cb92f 100644 --- a/third_party/google/protobuf/text_format.py +++ b/third_party/protobuf26/text_format.py @@ -39,9 +39,9 @@ __author__ = 'kenton@google.com (Kenton Varda)' import cStringIO import re -from google.protobuf.internal import type_checkers -from google.protobuf import descriptor -from google.protobuf import text_encoding +from protobuf26.internal import type_checkers +from protobuf26 import descriptor +from protobuf26 import text_encoding __all__ = ['MessageToString', 'PrintMessage', 'PrintField', 'PrintFieldValue', 'Merge']