diff options
| author | Aurelien Bompard <aurelien@bompard.org> | 2011-05-17 08:12:10 +0200 |
|---|---|---|
| committer | Aurelien Bompard <aurelien@bompard.org> | 2011-05-17 08:12:10 +0200 |
| commit | 606015e88f41070ffb182dfcc57926a858dd3358 (patch) | |
| tree | 632ac4b3320eb758a59066f6368f27485c6c80a0 /pkg_resources.py | |
| parent | 44c1998e667e3ccd2f793e29c6bac3806a08e1ee (diff) | |
| download | python-setuptools-git-606015e88f41070ffb182dfcc57926a858dd3358.tar.gz | |
Don't try to import the parent of a namespace package in declare_namespace -- fixes #204
--HG--
branch : distribute
extra : rebase_source : 1644e937b2d0b2fae58e27740d0fddfe082586cd
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 |
