From f7019918a76ed9edfa2f821871c8de75fef4e8c0 Mon Sep 17 00:00:00 2001 From: Wonjae Park Date: Thu, 5 Feb 2026 16:38:18 +0900 Subject: [PATCH 1/2] Fix on removing temp file from SCANOSS Signed-off-by: Wonjae Park --- requirements.txt | 2 +- src/fosslight_source/run_scanoss.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/requirements.txt b/requirements.txt index 3c58500..924db8d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ pyparsing -scanoss>=1.18.0 +scanoss>=1.19.0 XlsxWriter fosslight_util>=2.1.37 PyYAML diff --git a/src/fosslight_source/run_scanoss.py b/src/fosslight_source/run_scanoss.py index 6327e8a..8404146 100755 --- a/src/fosslight_source/run_scanoss.py +++ b/src/fosslight_source/run_scanoss.py @@ -13,6 +13,7 @@ from ._parsing_scanoss_file import parsing_scan_result # scanoss from ._parsing_scanoss_file import parsing_extra_info # scanoss from scanoss.scanner import Scanner, ScanType +from scanoss.scanoss_settings import ScanossSettings import io import contextlib @@ -55,12 +56,14 @@ def run_scanoss_py(path_to_scan: str, output_path: str = "", format: list = [], os.remove(output_json_file) try: + scanoss_settings = ScanossSettings() scanner = Scanner( ignore_cert_errors=True, skip_folders=list(path_to_exclude) if path_to_exclude else [], scan_output=output_json_file, scan_options=ScanType.SCAN_SNIPPETS.value, - nb_threads=num_threads if num_threads > 0 else 10 + nb_threads=num_threads if num_threads > 0 else 10, + scanoss_settings=scanoss_settings ) output_buffer = io.StringIO() @@ -80,14 +83,13 @@ def run_scanoss_py(path_to_scan: str, output_path: str = "", format: list = [], with open(output_json_file, "r") as st_json: st_python = json.load(st_json) scanoss_file_list = parsing_scan_result(st_python, excluded_files) - - if not write_json_file: - if os.path.isfile(output_json_file): - os.remove(output_json_file) - except Exception as error: logger.debug(f"SCANOSS Parsing {path_to_scan}: {error}") + if not write_json_file: + if os.path.isfile(output_json_file): + os.remove(output_json_file) + logger.info(f"|---Number of files detected with SCANOSS: {(len(scanoss_file_list))}") return scanoss_file_list, api_limit_exceed From 54bd21aa4c053a978f71a6e8b3625740d150b599 Mon Sep 17 00:00:00 2001 From: Wonjae Park Date: Thu, 5 Feb 2026 16:41:40 +0900 Subject: [PATCH 2/2] Restore wfp file delete code for legacy env Signed-off-by: Wonjae Park --- src/fosslight_source/run_scanoss.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/fosslight_source/run_scanoss.py b/src/fosslight_source/run_scanoss.py index 8404146..f1fdb7c 100755 --- a/src/fosslight_source/run_scanoss.py +++ b/src/fosslight_source/run_scanoss.py @@ -20,6 +20,7 @@ logger = logging.getLogger(constant.LOGGER_NAME) warnings.filterwarnings("ignore", category=FutureWarning) _PKG_NAME = "fosslight_source" +SCANOSS_RESULT_FILE = "scanner_output.wfp" SCANOSS_OUTPUT_FILE = "scanoss_raw_result.json" @@ -52,6 +53,7 @@ def run_scanoss_py(path_to_scan: str, output_path: str = "", format: list = [], return scanoss_file_list, api_limit_exceed output_json_file = os.path.join(output_path, SCANOSS_OUTPUT_FILE) + output_wfp_file = os.path.join(output_path, SCANOSS_RESULT_FILE) if os.path.exists(output_json_file): os.remove(output_json_file) @@ -89,6 +91,8 @@ def run_scanoss_py(path_to_scan: str, output_path: str = "", format: list = [], if not write_json_file: if os.path.isfile(output_json_file): os.remove(output_json_file) + if os.path.isfile(output_wfp_file): + os.remove(output_wfp_file) logger.info(f"|---Number of files detected with SCANOSS: {(len(scanoss_file_list))}")