From 2906e11517d41e6b6b3a898875d8054419254a6d Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 15 Oct 2024 20:47:17 +0300 Subject: [PATCH] fix default url and copyright encoding issues --- .gitignore | 5 ++++- setup.py | 2 +- vcpkg_sbom/__init__.py | 11 +++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index cdb0535..20055b9 100644 --- a/.gitignore +++ b/.gitignore @@ -161,4 +161,7 @@ cython_debug/ # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ -/.vscode/ \ No newline at end of file +/.vscode/ +*.spdx.json +*_license_info.json +*_EULA.txt \ No newline at end of file diff --git a/setup.py b/setup.py index a57118b..0528d41 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ def get_requirements(): PACKAGE_NAME = "vcpkg-sbom" -VERSION = "0.0.4" +VERSION = "0.0.5" AUTHOR = "Moverse P.C." EMAIL = "info@moverse.ai" LICENSE = "MIT" diff --git a/vcpkg_sbom/__init__.py b/vcpkg_sbom/__init__.py index e47bab7..8883b59 100644 --- a/vcpkg_sbom/__init__.py +++ b/vcpkg_sbom/__init__.py @@ -10,6 +10,7 @@ import typing import rich +import rich.panel import rich.progress import spdx_tools.spdx.document_utils import spdx_tools.spdx.model as spdx @@ -137,13 +138,14 @@ def _add_licenses( os.linesep, "*" * 80, os.linesep, + "\t" * 5, pkg_name, os.linesep, "*" * 80, os.linesep, ] ) - with open(license_path, "r") as f: + with open(license_path, "r", errors="ignore") as f: writer.write(f.read()) pbar.update(task, advance=1) @@ -176,7 +178,7 @@ def _parse_args(): "-n", "--namespace", type=str, - default="spdx.org/spdxdocs", + default="https://spdx.org/spdxdocs/", help="The software's namespace to use for the `spdx` file.", ) parser.add_argument( @@ -211,6 +213,11 @@ def _parse_args(): def run(): args = _parse_args() vcpkg_triplet_path = pathlib.Path(args.vcpkg_root) / pathlib.Path(args.triplet) + if not os.path.exists(vcpkg_triplet_path): + rich.print( + f"Manifest path [[cyan italic]{vcpkg_triplet_path}[/cyan italic]] [red][bold]does not[/bold] exist[/red], exiting." + ) + exit(-1) spdx_json_paths = set() for spdx_json_path in vcpkg_triplet_path.glob("**/share/**/*.spdx.json"):