diff options
Diffstat (limited to 'pkg_resources.py')
| -rw-r--r-- | pkg_resources.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/pkg_resources.py b/pkg_resources.py index 30dbc188..5eb19df3 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -1773,11 +1773,12 @@ def declare_namespace(packageName): if '.' in packageName: parent = '.'.join(packageName.split('.')[:-1]) declare_namespace(parent) - __import__(parent) - try: - path = sys.modules[parent].__path__ - except AttributeError: - raise TypeError("Not a package:", parent) + if parent not in _namespace_packages: + __import__(parent) + try: + path = sys.modules[parent].__path__ + except AttributeError: + raise TypeError("Not a package:", parent) # Track what packages are namespaces, so when new path items are added, # they can be updated |
