[Distutils] patch: solving the two major things that people dislike about setuptools, part 1

Phillip J. Eby pje at telecommunity.com
Sat Jan 24 05:06:29 CET 2009

Packages that aren't installed in eggs don't need to be "before their 
own directory".  The only reason that .egg files or directories do, 
is because if there's a non-egg package in the same directory, it 
could conflict with or override the .egg version otherwise.

At 05:43 PM 1/23/2009, Mark Sienkiewicz wrote:
>Ben Finney wrote:
>>Mark Sienkiewicz <sienkiew at stsci.edu> writes:
>>>In that case, the .egg file should go on sys.path immediately before
>>>the directory where it is stored. This ensures that a setuptools
>>>.egg file will always be discovered before a distutils-installed
>>>package/module in the same directory, but it will not override
>>>packages/modules that occur earlier in sys.path.
>>What of distributions installed via setuptools that are *not*
>>installed as eggs?
>I don't know.  Can you tell me more about that?  I'm not 
>particularly familiar with setuptools -- I'm just offering to write 
>the patch because I don't see it getting fixed any other way.
>Every thing that I have ever installed with setuptools has landed in 
>a file or directory named like "*.egg".  For example:
>The installation creates a file "easy-install.pth" that looks like this:
>% cat easy-install.pth
>import sys; sys.__plen = len(sys.path)
>import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; 
>p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)
>So, where I said ".egg files", you can substitute the name of the 
>things on line 2 through N-1 in the easy-install.pth file.
>That last line of easy-install.pth guarantees that the .egg files 
>(in this example, they are all eggs) will be placed in the wrong 
>place on sys.path, and that is all I am proposing to fix.  If there 
>is another case that does not involve the easy-install.pth file, 
>that is outside the scope of my patch.
>So, about distributions that are not installed as eggs: Can you tell 
>me a little about it?  Can you give me an example of how I can see 
>it happen?  Or does it turn out to be irrelevant to my patch?
>Mark S.
>Distutils-SIG maillist  -  Distutils-SIG at python.org

More information about the Distutils-SIG mailing list