summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Laxalde <denis.laxalde@logilab.fr>2014-10-24 12:04:39 +0200
committerDenis Laxalde <denis.laxalde@logilab.fr>2014-10-24 12:04:39 +0200
commit7de71ac6368676f098cdd37ad8d5dffe79a82b10 (patch)
tree14835405c0cfa4b856bcb36a940060fffb6cf624
parent22181e2b6ebaf3f6c4739188fd187069e11c661b (diff)
downloadastroid-git-7de71ac6368676f098cdd37ad8d5dffe79a82b10.tar.gz
[modutils] Ensure module is actually in sys.modules in pkg_resources support
Wrap the long line along the way. Closes #52.
-rw-r--r--modutils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/modutils.py b/modutils.py
index 1f4a4fc5..7b3840b3 100644
--- a/modutils.py
+++ b/modutils.py
@@ -552,7 +552,10 @@ def _module_file(modpath, path=None):
except AttributeError:
checkeggs = False
# pkg_resources support (aka setuptools namespace packages)
- if pkg_resources is not None and modpath[0] in pkg_resources._namespace_packages and len(modpath) > 1:
+ if (pkg_resources is not None
+ and modpath[0] in pkg_resources._namespace_packages
+ and modpath[0] in sys.modules
+ and len(modpath) > 1):
# setuptools has added into sys.modules a module object with proper
# __path__, get back information from there
module = sys.modules[modpath.pop(0)]