[Distutils] Questions about Python Eggs

Phillip J. Eby pje at telecommunity.com
Sun May 22 22:49:02 CEST 2005


At 02:51 PM 5/22/2005 -0500, Ian Bicking wrote:
>Phillip J. Eby wrote:
>>At 01:07 PM 5/22/2005 -0500, Ian Bicking wrote:
>>
>>>Ah, it's much easier than we realized:
>>>
>>>   python setup.py --command-packages=setuptools.command bdist_egg
>>
>>By the way, this only works with Python 2.4 and up.
>
>Blast, foiled again!  Oh well, moving bdist_egg.py into distutils/command 
>works (at least for 2.3).  Since the whole point is to keep other people 
>from having to run setup.py (by just distributing the eggs), that's not 
>too big a deal.
>
>I guess this is the classic problem where standard library enhancements 
>are more distracting than useful when you can't rely on a specific version 
>of Python.

By the way, I noticed from your edit that you're having problems with "some 
packages"; here's my revision to that section, which might help you out 
with that:

"""Note: packages that expect to find data files in their package 
directories, but which do not use either the PEP 302 API or the 
``pkg_resources`` API to find them will *not* work when packaged as .egg 
files.  One way you can check for this is if the .egg file contains data 
files, and the package is using ``__file__`` to find them.  You'll need to 
then patch the package so it uses ``pkg_resources.resource_filename()`` or 
one of the other ``resource_*`` APIs instead of ``__file__``.

Also, some packages (e.g. wxPython) may include dynamic link libraries 
other than Python extensions.  If this is the case, you'll need to create 
an ``eager_resources.txt`` file in the ``.egg-info`` directory that lists 
the in-zip paths to these libraries, one per line.  This will let the 
runtime system know that those files need to be unpacked if any of the 
extensions are used.  Thus, when attempting to import an extension, the 
runtime will also unpack all the dynamic link libraries that go with it.

(Note: if you still can't get the library to work as an .egg file after 
trying the above tactics, please report your problem on the distutils-Sig 
mailing list.  Thanks.)"""



More information about the Distutils-SIG mailing list