1313from ._parsing_scanoss_file import parsing_scan_result # scanoss
1414from ._parsing_scanoss_file import parsing_extra_info # scanoss
1515from scanoss .scanner import Scanner , ScanType
16+ from scanoss .scanoss_settings import ScanossSettings
1617import io
1718import contextlib
1819
1920logger = logging .getLogger (constant .LOGGER_NAME )
2021warnings .filterwarnings ("ignore" , category = FutureWarning )
2122_PKG_NAME = "fosslight_source"
23+ SCANOSS_RESULT_FILE = "scanner_output.wfp"
2224SCANOSS_OUTPUT_FILE = "scanoss_raw_result.json"
2325
2426
@@ -51,16 +53,19 @@ def run_scanoss_py(path_to_scan: str, output_path: str = "", format: list = [],
5153 return scanoss_file_list , api_limit_exceed
5254
5355 output_json_file = os .path .join (output_path , SCANOSS_OUTPUT_FILE )
56+ output_wfp_file = os .path .join (output_path , SCANOSS_RESULT_FILE )
5457 if os .path .exists (output_json_file ):
5558 os .remove (output_json_file )
5659
5760 try :
61+ scanoss_settings = ScanossSettings ()
5862 scanner = Scanner (
5963 ignore_cert_errors = True ,
6064 skip_folders = list (path_to_exclude ) if path_to_exclude else [],
6165 scan_output = output_json_file ,
6266 scan_options = ScanType .SCAN_SNIPPETS .value ,
63- nb_threads = num_threads if num_threads > 0 else 10
67+ nb_threads = num_threads if num_threads > 0 else 10 ,
68+ scanoss_settings = scanoss_settings
6469 )
6570
6671 output_buffer = io .StringIO ()
@@ -80,14 +85,15 @@ def run_scanoss_py(path_to_scan: str, output_path: str = "", format: list = [],
8085 with open (output_json_file , "r" ) as st_json :
8186 st_python = json .load (st_json )
8287 scanoss_file_list = parsing_scan_result (st_python , excluded_files )
83-
84- if not write_json_file :
85- if os .path .isfile (output_json_file ):
86- os .remove (output_json_file )
87-
8888 except Exception as error :
8989 logger .debug (f"SCANOSS Parsing { path_to_scan } : { error } " )
9090
91+ if not write_json_file :
92+ if os .path .isfile (output_json_file ):
93+ os .remove (output_json_file )
94+ if os .path .isfile (output_wfp_file ):
95+ os .remove (output_wfp_file )
96+
9197 logger .info (f"|---Number of files detected with SCANOSS: { (len (scanoss_file_list ))} " )
9298
9399 return scanoss_file_list , api_limit_exceed
0 commit comments