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: 1 addition & 1 deletion licensecheck/packageinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def get_package_info(self, package: PackageInfo) -> PackageInfo:
return pkg_info

tokens = sorted(parsed.literals)
pkg_info.license = ucstr(JOINS.join(x.key for x in tokens))
pkg_info.license = ucstr(JOINS.join(getattr(x, "key", str(x)) for x in tokens))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pkg_info.license = ucstr(JOINS.join(getattr(x, "key", str(x)) for x in tokens))
final_keys = []
for token in parsed.literals:
final_keys.extend(sub_symbol.key for sub_symbol in token.decompose())
pkg_info.license = ucstr(JOINS.join(finals_keys))

Maybe use the decompose function to get the symbols and not fallback to a simple string representation?

Copy link
Copy Markdown
Author

@joanise joanise Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested your suggestion, and I'm not sure what the better answer is. With my code, for the test file I provided, I get:

│ ✔          │ llvmlite │ APACHE-2.0 WITH LLVM-EXCEPTION;; BSD-2-CLAUSE │

with your suggested change, instead, I get the warnings 'LLVM-EXCEPTION' License not identified so falling back to UNKNOWN followed by

│ ✔          │ llvmlite │ APACHE-2.0;; LLVM-EXCEPTION;; BSD-2-CLAUSE │

which is not technically correct: llvmlite does not have Apache-2.0 as a license and LLVM-Exception as a license, rather it has "The Apache License v2.0 with LLVM Exceptions" as a license (see https://github.com/numba/llvmlite/blob/main/LICENSE.thirdparty).

Given that, I believe license_expression="BSD-2-Clause AND Apache-2.0 WITH LLVM-exception", (see https://github.com/numba/llvmlite/blob/20226fe41989cffeea322332bb1356c4b1d5a65d/setup.py#L223) should get rendered as my proposed change does.

Maybe there's a cleaner way to accomplish this than my simple casting to a string? I'm open to suggestions.


return pkg_info

Expand Down
1 change: 1 addition & 0 deletions tests/data/issue_137.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
llvmlite==0.46.0