diff --git a/src/fromager/pkgmetadata/pep639.py b/src/fromager/pkgmetadata/pep639.py index 2817f4a1..b2c47c56 100644 --- a/src/fromager/pkgmetadata/pep639.py +++ b/src/fromager/pkgmetadata/pep639.py @@ -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, @@ -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, diff --git a/tests/test_pkgmetadata.py b/tests/test_pkgmetadata.py index ffc9384c..ec5833e0 100644 --- a/tests/test_pkgmetadata.py +++ b/tests/test_pkgmetadata.py @@ -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=[ @@ -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"]),