Re: [Distutils] get_metadata in Distutils
At 06:48 PM 1/10/2009 +0100, Tarek Ziadé wrote:
Hello,
I am going to work on a change in Distutils to include a get_metadata API, http://bugs.python.org/issue4908
I don't see yet if this can be hard to do, and I will probably discover it while doing it,
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. 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. 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.
On Sat, Jan 10, 2009 at 9:09 PM, Phillip J. Eby <pje@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 ? Regards Tarek
-- Tarek Ziadé | Association AfPy | www.afpy.org Blog FR | http://programmation-python.org Blog EN | http://tarekziade.wordpress.com/
participants (2)
-
Phillip J. Eby
-
Tarek Ziadé