[Distutils] cracked eggs

Ryan Tomayko rtomayko at gmail.com
Mon Jun 20 06:03:28 CEST 2005


I've noticed that many packages that use __file__ and path operations  
instead of the pkg_resources / PEP 302 APIs to load package data  
usually work fine if you move the .egg file out of the way and then  
extract it to a directory with the same name. I have a little shell  
script ("crack_egg") that does this for me but I was wondering if  
this might be something that package authors could specify for their  
packages somehow, or maybe easy_install could take a command line arg  
or something?

I guess it gets pretty messy.

I remember reading somewhere that .egg files speed up import times  
over .egg directories because the zip index is quicker than the file  
system or something. But is it really that significant? Considering  
that a decent number of potential eggs are broken due to the resource  
API I wonder if it might be nice to have the option to prefer .egg  
directories for all packages installed by easy_install (e.g. by  
defaulting some option in ~/pydistutils.cfg).



here's that script:

$ cat $(which crack_egg)
#!/bin/bash
# usage: crack_egg egg-file [egg-file] ...
for arg in $@ ; do
     mv $arg{,.zip}
     mkdir $arg
     unzip -d $arg $arg.zip
done

Ryan Tomayko
                                  rtomayko at gmail.com
                                  http://naeblis.cx/rtomayko/




More information about the Distutils-SIG mailing list