eggs end up at end of sys.path
First, I want to say that I am very glad that setuptools/eggs are being developed - it is a great thing for Python. I have been lurking on this list for a while. The two features that convinced me it was time to start using setuptools were automatic generation of .exe starter programs from console_scripts entry points, and this feature: """ Activated distributions are now inserted in sys.path (and the working set) just before the directory that contains them, instead of at the end. This allows e.g. eggs in site-packages to override unmanaged modules in the same location, and allows eggs found earlier on sys.path to override ones found later. """ However, after I do a pkg_resources.require(), my egg always ends up at the end of sys.path. I exected the egg file to show up before the directory that contained it, in this case a non-site-packages directory in my PYTHONPATH. This is on setuptools versions 0.6a7 and 0.6a8dev-r41402. (Hopefully this is helpful feedback. If not let me know and I'll go back to lurking.) -- David Handy Computer Programming is Fun! Beginning Computer Programming with Python http://www.handysoftware.com/cpif/
At 03:10 PM 11/8/2005 -0500, David Handy wrote:
I have been lurking on this list for a while. The two features that convinced me it was time to start using setuptools were automatic generation of .exe starter programs from console_scripts entry points, and this feature:
""" Activated distributions are now inserted in sys.path (and the working set) just before the directory that contains them, instead of at the end. This allows e.g. eggs in site-packages to override unmanaged modules in the same location, and allows eggs found earlier on sys.path to override ones found later. """
However, after I do a pkg_resources.require(), my egg always ends up at the end of sys.path. I exected the egg file to show up before the directory that contained it, in this case a non-site-packages directory in my PYTHONPATH. This is on setuptools versions 0.6a7 and 0.6a8dev-r41402.
Could you provide me with your steps to reproduce, so I can try to find out what's wrong? One possibly important thing: the code that finds what sys.path entry contains the egg is currently case-sensitive and separator-sensitive. It's possible that if your PYTHONPATH uses lowercase and slash separators and the egg is the other way around, or vice versa, the container checking may be failing. You can verify this by printing sys.path after the require() and see if the paths are the same.
On Tue, Nov 08, 2005 at 04:11:31PM -0500, Phillip J. Eby wrote:
At 03:10 PM 11/8/2005 -0500, David Handy wrote:
""" Activated distributions are now inserted in sys.path (and the working set) just before the directory that contains them, instead of at the end. This allows e.g. eggs in site-packages to override unmanaged modules in the same location, and allows eggs found earlier on sys.path to override ones found later. """
However, after I do a pkg_resources.require(), my egg always ends up at the end of sys.path. I exected the egg file to show up before the directory that contained it, in this case a non-site-packages directory in my PYTHONPATH. This is on setuptools versions 0.6a7 and 0.6a8dev-r41402.
Could you provide me with your steps to reproduce, so I can try to find out what's wrong?
One possibly important thing: the code that finds what sys.path entry contains the egg is currently case-sensitive and separator-sensitive. It's possible that if your PYTHONPATH uses lowercase and slash separators and the egg is the other way around, or vice versa, the container checking may be failing. You can verify this by printing sys.path after the require() and see if the paths are the same.
I created a fairly minimal project which I have attached as MyProject-0.1.zip which demonstrates the problem. On Linux, it puts the egg in the proper place in sys.path (ahead of the PYTHONPATH directory), but on Windows it puts the egg file on the end. See the README.txt file for example output. (I have seen this problem on both Win98 and WinXP.) -- David Handy Computer Programming is Fun! Beginning Computer Programming with Python http://www.handysoftware.com/cpif/
At 09:41 PM 11/8/2005 -0500, David Handy wrote:
I created a fairly minimal project which I have attached as MyProject-0.1.zip which demonstrates the problem. On Linux, it puts the egg in the proper place in sys.path (ahead of the PYTHONPATH directory), but on Windows it puts the egg file on the end. See the README.txt file for example output. (I have seen this problem on both Win98 and WinXP.)
Based on the contents of README.txt, it's clearly a case-sensitivity issue, as 'c:\\home\\lib\\python\\myproject-0.1-py2.4.egg' doesn't start with 'C:\\home\\lib\\python' (lowercase vs. uppercase C:). I believe the correct fix therefore is for Distribution.insert_on() to normalize the sys.path entries before comparison. Please give revision 41408 a try. ("easy_install setuptools==dev" should upgrade you.)
On Tue, Nov 08, 2005 at 10:04:19PM -0500, Phillip J. Eby wrote:
At 09:41 PM 11/8/2005 -0500, David Handy wrote:
I created a fairly minimal project which I have attached as MyProject-0.1.zip which demonstrates the problem. On Linux, it puts the egg in the proper place in sys.path (ahead of the PYTHONPATH directory), but on Windows it puts the egg file on the end. See the README.txt file for example output. (I have seen this problem on both Win98 and WinXP.)
Based on the contents of README.txt, it's clearly a case-sensitivity issue, as 'c:\\home\\lib\\python\\myproject-0.1-py2.4.egg' doesn't start with 'C:\\home\\lib\\python' (lowercase vs. uppercase C:).
I believe the correct fix therefore is for Distribution.insert_on() to normalize the sys.path entries before comparison. Please give revision 41408 a try. ("easy_install setuptools==dev" should upgrade you.)
I ended up grabbing revision 41411. It worked great, thanks! Now the egg file appears before its containing directory, on both Linux and Windows. I'm going to have a lot of fun with setuptools; it meets some packaging/deployment needs that I have right now. Thanks again, -- David Handy Computer Programming is Fun! Beginning Computer Programming with Python http://www.handysoftware.com/cpif/
participants (2)
-
David Handy
-
Phillip J. Eby