pull-spdx-license.py: add the SPDX licenses exceptions
A message that is not in the archive (sent off-list or not yet received): [email protected]
Please consider this as an example. It does generate the extra license file. But I could not verify anything else.
see: https://bugzilla.yoctoproject.org/show_bug.cgi?id=16294
Quoted 67 lines · Jan Vermaete via lists.openembedded.org
Fetch and extract the SPDX exception licenses as the normal licenses are handled.
[YOCTO #16294]
Signed-off-by Jan Vermaete <[email protected]>--- scripts/pull-spdx-licenses.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)scripts/pull-spdx-licenses.py +12
-11@@ -55,20 +55,22 @@ def main(): data = json.load(response) version = data["tag_name"] - print(f"Pulling SPDX license list version {version}") - req = urllib.request.Request( - f"https://raw.githubusercontent.com/spdx/license-list-data/{version}/json/licenses.json" - ) - with urllib.request.urlopen(req) as response: - spdx_licenses = json.load(response) + spdx_licenses = {} + for jsonfile in ["licenses.json", "exceptions.json"]: + req = urllib.request.Request( + f"https://raw.githubusercontent.com/spdx/license-list-data/{version}/json/{jsonfile}" + ) + with urllib.request.urlopen(req) as response: + spdx_licenses.update(json.load(response)) + print(len(spdx_licenses)) with (TOP_DIR / "meta" / "files" / "spdx-licenses.json").open("w") as f: json.dump(spdx_licenses, f, sort_keys=True, indent=2) - total_count = len(spdx_licenses["licenses"]) + total_count = len(spdx_licenses["licenses"] + spdx_licenses["exceptions"]) updated = 0 - for idx, lic in enumerate(spdx_licenses["licenses"]): - lic_id = lic["licenseId"] + for idx, lic in enumerate(spdx_licenses["licenses"] + spdx_licenses["exceptions"]): + lic_id = lic.get("licenseId") or lic.get("licenseExceptionId") print(f"[{idx + 1} of {total_count}] ", end="")@@ -88,7 +90,7 @@ def main(): continue with dest_license_file.open("w") as f: - f.write(lic_data["licenseText"]) + f.write(lic_data.get("licenseText") or lic_data.get("licenseExceptionText")) updated += 1 print("done") --2.47.3
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#239697): https://lists.openembedded.org/g/openembedded-core/message/239697
Mute This Topic: https://lists.openembedded.org/mt/120005594/2167232
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 2 lines
Jan Vermaete “Success is a self-correcting phenomenom.” -- Gary Hamel