[Distutils] How to specific metadata version in setup.py?

Sridhar Ratnakumar sridharr at activestate.com
Fri Mar 19 22:35:48 CET 2010


On 2010-03-19, at 2:27 PM, Tarek Ziadé wrote:

> On Fri, Mar 19, 2010 at 5:22 PM, Tarek Ziadé <ziade.tarek at gmail.com> wrote:
> [..]
>> 
>> You can't do it, distutils will automatically set 1.0 or 1.1 depending
>> on the options you have used. (and not 1.2)
> 
> Re-reading the current distutils (1) code, I realize that it'll switch
> to 1.1 *only* if you have used
> provides, requires or obsolete, so it's partially implemented.

Ok. As a result of this, PKG-INFO that contains the "Classifiers" fields still has 1.0 as Metadata-Version. Consequently, http://pypi.python.org/pypi/pkginfo fails to read extra metadata fields. If Tres is reading this, I had to do the following hack as a workaroud:

    from pkginfo import Distribution
    
    class PkgInfoFile(Distribution):
        # Not all packages' PKG-INFO define the proper metadata
        # For eg., modern-package-template uses the Classifiers field and yet
        # uses 1.0 as the metadata version (Classifiers is only defined in 1.1)
        metadata_version = '1.2' # not all PKG-INFO file have proper metadata version
        

> The new class is much cleaner in the implementation, and so is the
> register command for PyPI.
> 
> Notice that we have almost finished the implementation of PEP 345 on
> PyPI side so we will soon be able to push PEP 345 fields over there.

Wasn't PEP 345 fully implemented for distutils1? Ah, I see that it is still "Draft" mode. 

Can I use distutils2 to parse PKG-INFO (as a replacement for the `pkginfo` project)? Will it read all the fields despite the inaccurate Metadata-Version field?

-srid

[1] http://www.python.org/dev/peps/pep-0301/#distutils-trove-classification
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20100319/f061d4eb/attachment-0001.html>


More information about the Distutils-SIG mailing list