Le 24/05/2012 15:26, Tarek Ziadé a écrit :
On 5/24/12 3:07 PM, Alexis Métaireau wrote:
the metadata version, which is 1.2

That doesn't seem to be available in PyPI direclty, nor via the XML-RPC interface: http://pypi.python.org/pypi/pelican/json

import xmlrpclib
client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
client.release_data('Pelican', '2.8.1')/keys()

Weird, I could have swore it was in there. We should add the 'metadata_version' key.

In the interim you can detect when it's a 1.2 because it has specific fields , by loading the metadata in a packaging.metadata.Metadata instance
and ask it to detect the version.
Oh, it seems that new distributions do have a "requires_dist" field, so I can use this and determine if it's a PEP 345 dist or not from there.

Well, I could if I had the metadata fields there, but they aren't present (PyPI doesn't do anything with the setup.py to get the metadata related fields it seems).

Using packaging/distutils2.metadata.Metadata to guess the version of the metadata is thus not working for me when getting this metadata from PyPI.

For instance:

>>> from distutils2.pypi import xmlrpc
>>> rel = xmlrpc.Client().get_metadata('gitbuster', '2.1b7')
>>> rel.metadata['metadata-version']
UNKNOWN
>>> rel.metadata['requires-dist']
['gfbi_core (==0.5b6)', 'argparse']

So I guess I will rely on having something in the "requires-dist" or not to determine the version of the metadata for now..
_______________________________________________
Catalog-SIG mailing list
[email protected]
http://mail.python.org/mailman/listinfo/catalog-sig

Reply via email to