wonlay: thanks for the great hint! I've been seeing a similar problem at
home, on my OS-X box, and thanks to your suggestion I was able to figure out
the problem. I don't yet know the solution, though :).
My general policy is to only ever to 'sudo install' when the install target
is to a stow-managed per-package-per-version directory. So in this case, when
I installed the "foolscap" package, I put it in
/usr/local/stow/foolscap-0.4.2/ , and then told stow to symlink it into place
at /usr/local/lib/python2.5/site-packages .
I then see this warning any time anything imports foolscap.
When pkg_resources.Distribution.check_version_conflict() is asked (for some
reason, I don't know why) to check on the 'foolscap' package, it sees that
the __file__ attribute points to:
/usr/local/lib/python2.5/site-packages/foolscap/__init__.pyc
When it does a normalize_path() on that, it is told that __init__.pyc lives
in:
/usr/local/stow/foolscap-0.4.2/lib/python2.5/site-packages/foolscap/__init__.pyc
and indeed that is not on sys.path, so it emits the warning.
I guess what I want it to do is to figure out where the module really got
imported from first: chop off the module name and the __init__.pyc to get
"/usr/local/lib/python2.5/site-packages", then do a normalize_path() on that,
and *then* compare it against 'loc'. I don't know how to do that offhand..
will there always be an __init__.pyc file?
cheers,
-Brian |