-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f8af7e
commit 893e1f2
Showing
8 changed files
with
34 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (C) 2024 Anthony Harrison | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
VERSION: str = "0.7.1" | ||
VERSION: str = "0.7.2" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,35 @@ | ||
import os | ||
import json | ||
import os | ||
|
||
import requests | ||
|
||
license_dir, filename = os.path.split(__file__) | ||
# Bodge the pathname | ||
license_path = os.path.join(license_dir, "../lib4sbom/license_data", "spdx_licenses.json") | ||
license_path = os.path.join( | ||
license_dir, "../lib4sbom/license_data", "spdx_licenses.json" | ||
) | ||
licfile = open(license_path, "r", encoding="utf-8") | ||
licenses = json.load(licfile) | ||
|
||
# Process each licence | ||
for lic in licenses["licenses"]: | ||
#print (lic) | ||
# print (lic) | ||
id = lic["licenseId"].lower() | ||
name = lic["name"].lower() | ||
url = lic["detailsUrl"] | ||
print (f"{name} - {id}: {url}") | ||
print(f"{name} - {id}: {url}") | ||
|
||
filename=f"{id}.txt" | ||
filename = f"{id}.txt" | ||
file_path = os.path.join(license_dir, "../lib4sbom/license_data/text", filename) | ||
# Get text | ||
try: | ||
license_text = requests.get(url).json() | ||
if license_text.get("licenseText") is not None: | ||
#text=license_text["licenseText"] | ||
html=license_text["licenseTextHtml"] | ||
#print (html) | ||
# text=license_text["licenseText"] | ||
html = license_text["licenseTextHtml"] | ||
# print (html) | ||
# Create file | ||
with open(file_path,"w") as f: | ||
with open(file_path, "w") as f: | ||
f.write(html) | ||
except requests.exceptions.RequestException: | ||
print (f"Unable to find license text for {name}") | ||
|
||
|
||
print(f"Unable to find license text for {name}") |