Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't fail for complex license expressions #718

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 4 additions & 0 deletions flit_core/flit_core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,10 @@ def normalize_license_expr(s: str):
"""
from ._spdx_data import licenses
ls = s.lower()
if any(keyword in ls for keyword in ("and", "or", "with")):
# TODO complex license expressions
return s

if ls.startswith('licenseref-'):
ref = s.partition('-')[2]
if re.match(r'([a-zA-Z0-9\-.])+$', ref):
Expand Down
7 changes: 5 additions & 2 deletions flit_core/tests_core/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,11 @@ def test_bad_pep621_readme(readme, err_match):
("mit", "MIT"),
("apache-2.0", "Apache-2.0"),
("APACHE-2.0+", "Apache-2.0+"),
# TODO: compound expressions
#("mit and (apache-2.0 or bsd-2-clause)", "MIT AND (Apache-2.0 OR BSD-2-Clause)"),
("MIT AND BSD-2-Clause", "MIT AND BSD-2-Clause"),
("MIT OR BSD-2-Clause", "MIT OR BSD-2-Clause"),
("GPL-2.0-only WITH Classpath-exception-2.0", "GPL-2.0-only WITH Classpath-exception-2.0"),
# TODO: compound expressions should be checked and normalized
# ("mit and (apache-2.0 or bsd-2-clause)", "MIT AND (Apache-2.0 OR BSD-2-Clause)"),
# LicenseRef expressions: only the LicenseRef is normalised
("LiceNseref-Public-DoMain", "LicenseRef-Public-DoMain"),
])
Expand Down