On 5/24/12 3:49 PM, Alexis Métaireau wrote:
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).
that's done on client side when you call "register", it sends the
metadata as a dict
see
http://hg.python.org/distutils2/file/0291648eb2b2/distutils2/command/register.py#l220
then PyPI just stores them into a SQL table - so the values that are
kept are the one defined by the sql schema since it does not store a blob.
What we need to add is a feature at PyPI that extracts setup.cfg from
the release, and make it available at an url
so if you have it you know it's the new standard,
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..
Yes but if the project does not have any dependencies it won't work.
_______________________________________________
Catalog-SIG mailing list
[email protected]
http://mail.python.org/mailman/listinfo/catalog-sig