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

Add check for licenses #49

Merged
merged 5 commits into from
Dec 12, 2023
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
19 changes: 19 additions & 0 deletions news/49-license-info
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* Do not crash if the metadata in one or more packages does not specify a `license` field. (#49)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
6 changes: 5 additions & 1 deletion src/licenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ def dump_licenses(prefix, include_text=False, text_errors=None, output="licenses
licenses = defaultdict(dict)
for info_json in Path(prefix).glob("conda-meta/*.json"):
info = json.loads(info_json.read_text())
license_info = info.get("license")
if license_info is None:
print(f"WARNING: no license for {info['name']}")
continue
jaimergp marked this conversation as resolved.
Show resolved Hide resolved
extracted_package_dir = info["extracted_package_dir"]
licenses_dir = os.path.join(extracted_package_dir, "info", "licenses")
licenses[info["name"]]["type"] = info["license"]
licenses[info["name"]]["type"] = license_info
licenses[info["name"]]["files"] = license_files = []
if not os.path.isdir(licenses_dir):
continue
Expand Down
Loading