diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2016-02-24 10:50:03 -0800 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2016-02-24 10:50:03 -0800 |
commit | cc775f7ac1589eda26fc65602d228baef8001944 (patch) | |
tree | bfaa2561a7d6039166cf4c6956f9450e4d0ac9eb | |
parent | fc51bdc033f458d14273bf6605dad4157e609c84 (diff) | |
parent | 786f80fe6632902be74f90a577d75e8641494abd (diff) | |
download | protobuf-cc775f7ac1589eda26fc65602d228baef8001944.tar.gz protobuf-cc775f7ac1589eda26fc65602d228baef8001944.tar.bz2 protobuf-cc775f7ac1589eda26fc65602d228baef8001944.zip |
Merge pull request #1259 from silviulica/master
Add a modified patch from craigcitro@ to handle namespace sharing.
-rwxr-xr-x | python/google/__init__.py | 5 | ||||
-rwxr-xr-x | python/google/protobuf/__init__.py | 6 | ||||
-rw-r--r-- | python/google/protobuf/pyext/__init__.py | 4 | ||||
-rwxr-xr-x | python/setup.py | 1 |
4 files changed, 14 insertions, 2 deletions
diff --git a/python/google/__init__.py b/python/google/__init__.py index de40ea7c..55856141 100755 --- a/python/google/__init__.py +++ b/python/google/__init__.py @@ -1 +1,4 @@ -__import__('pkg_resources').declare_namespace(__name__) +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + __path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py index 533821c1..5d244191 100755 --- a/python/google/protobuf/__init__.py +++ b/python/google/protobuf/__init__.py @@ -31,3 +31,9 @@ # Copyright 2007 Google Inc. All Rights Reserved. __version__ = '3.0.0b2' + +if __name__ != '__main__': + try: + __import__('pkg_resources').declare_namespace(__name__) + except ImportError: + __path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/python/google/protobuf/pyext/__init__.py b/python/google/protobuf/pyext/__init__.py index e69de29b..55856141 100644 --- a/python/google/protobuf/pyext/__init__.py +++ b/python/google/protobuf/pyext/__init__.py @@ -0,0 +1,4 @@ +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + __path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/python/setup.py b/python/setup.py index 6ea3bad7..24ac53db 100755 --- a/python/setup.py +++ b/python/setup.py @@ -210,7 +210,6 @@ if __name__ == '__main__': "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", ], - namespace_packages=['google'], packages=find_packages( exclude=[ 'import_test_package', |