Commit Graph
1 Commits
Author SHA1 Message Date
Tore Martin HagenandClaude Opus 5.5 d20e261f91 fix(python): find license files under .dist-info/licenses (PEP 639) (#5496)
* fix(python): find license files under .dist-info/licenses (PEP 639)

PEP 639 (Metadata-Version 2.4) places license files in a licenses/
subdirectory of .dist-info. When a package declares no License or
License-Expression, the RECORD fallback only considered files directly
in .dist-info, so these packages were reported with no license.

Accept RECORD entries anywhere under .dist-info/licenses/ as license
file candidates as well.

See #4292

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tore Martin Hagen <tore@kosli.com>

* fix(python): resolve every declared License-File, including under licenses/

License-File may appear several times, but it was parsed as a single
value, so only the last entry was kept. Its path was also joined to the
metadata directory only, while PEP 639 (Metadata-Version 2.4) makes it
relative to .dist-info/licenses/. Packages without a RECORD entry for the
file therefore got no license.

Keep every License-File entry, and look each one up in the metadata
directory and then under licenses/. Entries whose names don't look like
license files (e.g. AUTHORS) are skipped, as the RECORD fallback already
does, so they don't show up as unidentified licenses.

Also cover isDistInfoLicenseCandidate with a table test, and use real
hashes in the PEP 639 fixture's RECORD.

See #4292

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tore Martin Hagen <tore@kosli.com>

---------

Signed-off-by: Tore Martin Hagen <tore@kosli.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 13:44:55 -05:00