Provides-extra parsing not reliable

Bug #1780524 reported by wim glenn
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pkginfo
Confirmed
Undecided
Unassigned

Bug Description

It seems the results are not good for "extras". For example wheel 0.30.0 provides some extras but they are not parsed from the metadata 2.0, though you can see them mentioned in requires_dist:

$ pkginfo wheel-0.30.0-py2.py3-none-any.whl -f provides_extras
$ pkginfo wheel-0.30.0-py2.py3-none-any.whl -f requires_dist
requires_dist: ["ed25519ll; extra == 'faster-signatures'", "keyring; extra == 'signatures'", "keyrings.alt; extra == 'signatures'", 'pyxdg; sys_platform!="win32" and extra == \'signatures\'', "jsonschema; extra == 'test'", "pytest (>=3.0.0); extra == 'test'", "pytest-cov; extra == 'test'"]

In a metadata 2.1 wheel, they are parsed, but there are dupes - perhaps pkginfo could de-dupe the results?

$ pkginfo wheel-0.31.1-py2.py3-none-any.whl -f provides_extras
provides_extras: ['test', 'signatures', 'faster-signatures', 'faster-signatures', 'signatures', 'signatures', 'test']

Revision history for this message
Tres Seaver (tseaver) wrote :

Thanks for the report. For the first part, the 'wheel-0.30.0' wheel claims its 'Metadata-Version' is '2.0', which means that it shouldn't have any 'Provides-Extra' headers (those were added in PEP 566 for the '2.1' version of the metadata spec). Thus, 'pkginfo' doesn't search for those headers.

The duplicates in the 'wheel-0.31.0' egg come from the use of conditional extras:

---------------------------------- %< ----------------------------------
Provides-Extra: test
Provides-Extra: signatures
Provides-Extra: faster-signatures
Provides-Extra: faster-signatures
Requires-Dist: ed25519ll; extra == 'faster-signatures'
Provides-Extra: signatures
Requires-Dist: keyring; extra == 'signatures'
Requires-Dist: keyrings.alt; extra == 'signatures'
Provides-Extra: signatures
Requires-Dist: pyxdg; (sys_platform!="win32") and extra == 'signatures'
Provides-Extra: test
Requires-Dist: pytest (>=3.0.0); extra == 'test'
Requires-Dist: pytest-cov; extra == 'test'
---------------------------------- %< ----------------------------------

Parsing such values "correctly" is going to be hard.

Changed in pkginfo:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers