Skip to content

Commit 786f80f

Browse files
committed
Add a modified patch from craigcitro@ to handle namespace sharing.
1 parent c003abb commit 786f80f

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

python/google/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
__import__('pkg_resources').declare_namespace(__name__)
1+
try:
2+
__import__('pkg_resources').declare_namespace(__name__)
3+
except ImportError:
4+
__path__ = __import__('pkgutil').extend_path(__path__, __name__)

python/google/protobuf/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,9 @@
3131
# Copyright 2007 Google Inc. All Rights Reserved.
3232

3333
__version__ = '3.0.0b2'
34+
35+
if __name__ != '__main__':
36+
try:
37+
__import__('pkg_resources').declare_namespace(__name__)
38+
except ImportError:
39+
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
try:
2+
__import__('pkg_resources').declare_namespace(__name__)
3+
except ImportError:
4+
__path__ = __import__('pkgutil').extend_path(__path__, __name__)

python/setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ def run(self):
210210
"Programming Language :: Python :: 3.3",
211211
"Programming Language :: Python :: 3.4",
212212
],
213-
namespace_packages=['google'],
214213
packages=find_packages(
215214
exclude=[
216215
'import_test_package',

0 commit comments

Comments
 (0)