Message351

Author warner
Recipients pje, quentinsf, warner, wdoekes, wonlay, zgoda, zooko
Date 2009-08-25.22:18:33
Content
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),
History
Date User Action Args
2009-08-25 22:18:33warnersetmessageid: <1251238713.85.0.948466066229.issue36@psf.upfronthosting.co.za>
2009-08-25 22:18:33warnersetrecipients: + warner, zooko, pje, wonlay, quentinsf, wdoekes, zgoda
2009-08-25 22:18:33warnerlinkissue36 messages
2009-08-25 22:18:33warnercreate