[Distutils] Utility to mirror an egg index from a Debian distribution

Sridhar Ratnakumar sridharr at activestate.com
Mon Jun 15 19:43:23 CEST 2009


On 09-05-15 09:25 AM, P.J. Eby wrote:
>> My current implementation idea is to unpack the tarball and use the
>> egg-metadata to figure out what the "egg" name of the tarball should be.
>
> Running "setup.py --name --version" will dump out the name and version,
> whether you use distutils or setuptools.  If you want a
> setuptools-compatible name and version, you'll need to postprocess those
> strings with pkg_resources.safe_name() and safe_version(), then escape
> them with to_filename() if you're using them as components of a sdist or
> egg filename.

There are two issues with relying on 'setup.py --<field>' to find the 
value of <field>:

1) setuptools prints warning messages to stdout: 
http://bugs.python.org/setuptools/issue73 (does `safe_name()` handle this?)

2) Some packages in PyPI prints unexpected messages depending upon the 
environment (even if you pass --name to setup.py). How do you suggest to 
find name/version under such cases?


More information about the Distutils-SIG mailing list