Re: [Distutils] problem finding an entry point
At 03:26 PM 9/1/2006 -0400, Kevin Dangoor wrote:
We've got a custom packaging setup that I'm trying to integrate a Nose plugin into. I'm using a single-version-externally-managed setup. Our packaging setup uses symlinks to link from a package area on disk to /usr/local/lib/python2.4/site-packages. Running "python" from the command line shows the libraries coming from the package area, not /usr/local...
For some reason, if I explicitly set my PYTHONPATH environment variable to include the /usr/local... directory it can find my plugin. If I don't set it, it can't find the plugin. (pkg_resources.require() can find my package and is able to confirm that the entry point is there...)
I think you're going to need to be more specific here. I'm not clear on what is being found when, by what. I'm also not clear what is being symlinked where.
While I have things working with the PYTHONPATH, I'd like to not have that requirement... any ideas what might keep this from working normally?
It's probably something to do with the symlinks, though it's hard to say what, exactly. pkg_resources contains some realpath() calls, but I'm not sure how they come into play in this scenario. More details, please.
On 9/1/06, Phillip J. Eby
I think you're going to need to be more specific here. I'm not clear on what is being found when, by what. I'm also not clear what is being symlinked where.
OK, here are specifics.... Things in /base/pkg/Foo/usr/local/lib/python2.4/site-packages are linked over to /usr/local/lib/python2.4/site-packages. (I doubt it makes a difference, but this whole thing is actually run in a chrooted environment...) It appears that in most instances (and I don't know enough about the packager to know which instances and why), the directories are real directories, but the files inside are symlinks. Specifically: /usr/local/lib/python2.4/site-packages/nose would be a real directory /usr/local/lib/python2.4/site-packages/nose/result.py is a symlink to /base/pkg/Foo/usr/local/lib/python2.4/site-packages/nose/result.py There's a nose-0.9.0-py2.4.egg-info directory next to the nose directory (again, the directory is real but the files inside are symlinks). One more important thing to know about this setup. We have a couple of different packages in /base/pkg, and they both contribute to /usr/local/lib... When you run python, the /baes/pkg... path for the package that contains Python is what shows up in sys.path (not /usr/local/lib/python2.4/site-packages). We created a sitecustomize.py file to add /usr/local/lib/python2.4/site-packages as a sitedir. We're able to import all of the python packages from that directory just fine. But, I wrote a nose plugin that is only found if I explicitly set a PYTHONPATH environment variable to point to /usr/local/lib/python2.4/site-packages.
From the Python prompt, if I iter_entry_points, I don't see my plugin without the PYTHONPATH. However, I can require my package and see the entry point via the API.
Hopefully that makes it clearer... Kevin
participants (2)
-
Kevin Dangoor
-
Phillip J. Eby