Provides-extra parsing not reliable
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.
$ pkginfo wheel-0.
requires_dist: ["ed25519ll; extra == 'faster-
In a metadata 2.1 wheel, they are parsed, but there are dupes - perhaps pkginfo could de-dupe the results?
$ pkginfo wheel-0.
provides_extras: ['test', 'signatures', 'faster-
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:
------- ------- ------- ------- ------ %< ------- ------- ------- ------- ------ ="win32" ) and extra == 'signatures' ------- ------- ------- ------ %< ------- ------- ------- ------- ------
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!
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.