Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/fromager/pkgmetadata/pep639.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ def _trove_to_spdx(troves: list[str]) -> LicenseExpression:
if mapped is None:
raise ValueError(f"{trove!r} is ambiguous")
trove_spdx.append(mapped)
if not trove_spdx:
raise ValueError("no classifier maps to a SPDX license expression")
# join with AND
return _parse_spdx(" AND ".join(trove_spdx), simplify=True)

Expand Down
12 changes: 12 additions & 0 deletions tests/test_pkgmetadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@ def test_license_from_metadata(metadata: Metadata, expected: str) -> None:
(None, None, None),
(None, "invalid", None),
(None, None, ["License :: OSI Approved :: BSD License"]),
# classifiers with no entry that maps to SPDX (see issue #1372)
(None, None, ["Programming Language :: Python :: 3"]),
(None, None, ["License :: OSI Approved"]),
# non-license classifier alongside an ambiguous license classifier
(
None,
None,
[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License",
],
),
],
)
def test_license_from_metadata_errors(
Expand Down
Loading