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

Tarek Ziadé ziade.tarek at gmail.com
Fri Mar 19 22:51:58 CET 2010


On Fri, Mar 19, 2010 at 5:35 PM, Sridhar Ratnakumar
<sridharr at activestate.com> wrote:
> [..]
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

Why do you force 1.2 here ? There's no tool out there that understand
PEP 345 / 1.2 yet.
At this time, I'd encourage you to put 1.1 here unless you use PEP 345 fields.

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

I'll switch it to Accepted now. But PEP 345 will not be implemented in
Distutils, which is now feature frozen.

> Can I use distutils2 to parse PKG-INFO (as a replacement for the `pkginfo`
> project)?

Yes you can.

> Will it read all the fields despite the inaccurate
> Metadata-Version field?

Yes, it should work. Description fields (==long_description)
containing empty lines will stay broken though,
because they can't be read back. That's fixed in PEP 345 / 1.2

Regards
Tarek
-- 
Tarek Ziadé | http://ziade.org


More information about the Distutils-SIG mailing list