[Distutils] Something that doesn't run from an egg

Ryan Tomayko rtomayko at gmail.com
Thu Jul 7 16:11:46 CEST 2005

On Jul 7, 2005, at 8:58 AM, Kevin Dangoor wrote:
> On 7/6/05, Phillip J. Eby <pje at telecommunity.com> wrote:
>> Here's a patch to setuptools that appears to fix the problem (by not
>> running imported scripts as __main__), and it's probably a good  
>> idea to add
>> it to setuptools in any case.  Meanwhile, however, somebody should  
>> probably
>> tell the py folks that _findpy is a horrible, *horrible* hack and  
>> should be
>> shot.  :)
> I just gave the patch a try. I just wanted to confirm that it's
> behaving the same way for me that it did for you. Running the py.test
> script no longer has trouble finding py, because of your patch.
> However, it still doesn't run (due to other things that py.test is
> doing). Specifically:
> py.error.ENOENT: [No such file or directory]:
> /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
> site-packages/py-0.8.0_alpha1-py2.4.egg/py/test/defaultconftest.py

I think this is due to the py library using __file__ and path  
operations instead of pkg_resources to load package data. I wasn't  
able to run it within an egg. If you crack the egg with something  
like the following, it seems to work fine::

     cd /Library/Frameworks/Python.framework/Versions/2.4/lib/ 
     mv py-0.8.0_alpha1-py2.4.egg py-0.8.0_alpha1-py2.4.egg.zip
     mkdir py-0.8.0_alpha1-py2.4.egg
     cd py-0.8.0_alpha1-py2.4.egg
     unzip ../py-0.8.0_alpha1-py2.4.egg.zip

Now you should be able to run everything and as a kinda-egg (e.g.  
metadata and scripts are available). Of course, there's not much  
value in using setuptools at all at this point. :)

I think the best path for getting the py lib to work with  
easy_install would be to just fix up their distutils setup and build  
a normal tar.gz source distributions. We can worry about porting the  
code to use pkg_resources at a later time. They've chosen to employ  
some interesting techniques for distribution, however, so I'm not  
sure how bad the problem is.

Ryan Tomayko
                                  rtomayko at gmail.com

More information about the Distutils-SIG mailing list