ok, here's a patch which resolves my particular problem, not sure if it's the
right thing to do or not:
diff --git a/pkg_resources.py b/pkg_resources.py
index 9edb6c0..b812371 100644
--- a/pkg_resources.py
+++ b/pkg_resources.py
@@ -2267,8 +2267,15 @@ class Distribution(object):
continue
fn = getattr(sys.modules[modname], '__file__', None)
- if fn and normalize_path(fn).startswith(loc):
+ if fn and (fn.startswith(loc) or normalize_path(fn).startswith(loc)):
continue
+ pieces = fn.split(os.path.sep)
+ if (len(pieces) > 2
+ and pieces[-1] in ("__init__.py", "__init__.pyc")
+ and pieces[-2] == modname):
+ fn2 = os.path.sep.join(pieces[:-2])
+ if normalize_path(fn2).startswith(loc):
+ continue
issue_warning(
"Module %s was already imported from %s, but %s is being added"
" to sys.path" % (modname, fn, self.location), |