Skip to content
Merged
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
6 changes: 4 additions & 2 deletions src/fromager/pkgmetadata/pep639.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ def _license_text_to_spdx(text: str) -> LicenseExpression:
"License :: OSI Approved :: European Union Public Licence 1.0 (EUPL 1.0)": "EUPL-1.0",
"License :: OSI Approved :: European Union Public Licence 1.1 (EUPL 1.1)": "EUPL-1.1",
"License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)": "EUPL-1.2",
"License :: OSI Approved :: GNU Affero General Public License v3": "AGPL-3.0-only",
# ambiguous, see PEP 639
"License :: OSI Approved :: GNU Affero General Public License v3": None,
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)": "AGPL-3.0-or-later",
# multiple versions
"License :: OSI Approved :: GNU Free Documentation License (FDL)": None,
Expand Down Expand Up @@ -234,7 +235,8 @@ def _license_text_to_spdx(text: str) -> LicenseExpression:
"License :: OSI Approved :: Zero-Clause BSD (0BSD)": "0BSD",
# multiple versions: ZPL-1.1, ZPL-2.0, ZPL-2.1
"License :: OSI Approved :: Zope Public License": None,
"License :: OSI Approved :: zlib/libpng License": "zlib-acknowledgement",
# zlib-acknowledgement is a different license that is not OSI approved
"License :: OSI Approved :: zlib/libpng License": "Zlib",
"License :: Other/Proprietary License": None,
"License :: Public Domain": None,
"License :: Repoze Public License": None,
Expand Down
8 changes: 8 additions & 0 deletions tests/test_pkgmetadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def test_project_urls_from_metadata(
[md(license="MIT and PSF-2.0"), "MIT AND PSF-2.0"],
[md(license="BSD 3-Clause License"), "BSD-3-Clause"],
[md(classifiers=["License :: OSI Approved :: MIT License"]), "MIT"],
# OSI-approved zlib License, not zlib/libpng with Acknowledgement
[md(classifiers=["License :: OSI Approved :: zlib/libpng License"]), "Zlib"],
[
md(
classifiers=[
Expand All @@ -117,6 +119,12 @@ def test_license_from_metadata(metadata: Metadata, expected: str) -> None:
(None, None, None),
(None, "invalid", None),
(None, None, ["License :: OSI Approved :: BSD License"]),
# "v3" does not say -only or -or-later, like the GPLv3 classifier
(
None,
None,
["License :: OSI Approved :: GNU Affero General Public License v3"],
),
# classifiers with no entry that maps to SPDX (see issue #1372)
(None, None, ["Programming Language :: Python :: 3"]),
(None, None, ["License :: OSI Approved"]),
Expand Down
Loading