[Distutils] get_metadata in Distutils

Tarek Ziadé ziade.tarek at gmail.com
Sun Jan 11 20:22:31 CET 2009

On Sat, Jan 10, 2009 at 9:09 PM, Phillip J. Eby <pje at telecommunity.com> wrote:
>> Since this is basically what has been done in setuptools, I thaught
>> that you might wanted to help around for this change ?
> I'd suggest looking at the pkg_resources code, particularly
> find_distributions and its related functions.

Ok thanks,

> Note, for example, that egg
> layouts can be nested (even when zipped!), and that the metadata can have
> different filenames, depending on the installation format.

This is my understanding at this stage :
>From a Distutils point of view, it seems that this would suffice to
read the metadata from the egg-info files :

1/ add in distutils.dist.DistributionMetadata a new method to be able
to load an existing egg-info file
2/ add in the pkgutil module, the get_metadata function, that could
have this signature:

   get_metadata(package_name, path_item)

where path_item is a site-packages like directory,

this function would scan the path_item directory, like what
setuptools.pkg_resource code does,
and return the metadata (+fill a cache with all packages metadata found)

> Version parsing
> also has certain peculiarities, which also means that people doing simple
> string comparisons on the version field is probably not going to suffice.

Wouldn't distutils.versionpredicate be useful here ?



Tarek Ziadé | Association AfPy | www.afpy.org
Blog FR | http://programmation-python.org
Blog EN | http://tarekziade.wordpress.com/

More information about the Distutils-SIG mailing list