2222from fosslight_util .output_format import check_output_format
2323from fosslight_reuse ._fosslight_reuse import run_lint as reuse_lint
2424from .common import (copy_file , call_analysis_api ,
25- overwrite_excel , extract_name_from_link )
25+ overwrite_excel , extract_name_from_link ,
26+ merge_yamls )
2627from fosslight_util .write_excel import merge_excels
2728from ._run_compare import run_compare
2829import subprocess
@@ -125,10 +126,10 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
125126 abs_path = os .path .abspath (src_path )
126127
127128 if success :
128- output_files = {"SRC" : "FL_Source.xlsx " ,
129- "BIN" : "FL_Binary.xlsx " ,
129+ output_files = {"SRC" : f "FL_Source{ output_extension } " ,
130+ "BIN" : f "FL_Binary{ output_extension } " ,
130131 "BIN_TXT" : "FL_Binary.txt" ,
131- "DEP" : "FL_Dependency.xlsx " ,
132+ "DEP" : f "FL_Dependency{ output_extension } " ,
132133 "REUSE" : "FL_Reuse.yaml" }
133134 if run_reuse :
134135 output_reuse = os .path .join (_output_dir , output_files ["REUSE" ])
@@ -151,7 +152,9 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
151152 False , num_cores , True )
152153 if success :
153154 sheet_list ["SRC_FL_Source" ] = [scan_item .get_row_to_print () for scan_item in result [2 ]]
154- create_report_file (0 , result [2 ], result [3 ], 'all' , True , _output_dir , output_files ["SRC" ], "" )
155+ need_license = True if output_extension == ".xlsx" else False
156+ create_report_file (0 , result [2 ], result [3 ], 'all' , need_license ,
157+ _output_dir , output_files ["SRC" ].split ('.' )[0 ], output_extension )
155158 else : # Run fosslight_source by using docker image
156159 src_output = os .path .join ("output" , output_files ["SRC" ])
157160 output_rel_path = os .path .relpath (abs_path , os .getcwd ())
@@ -186,10 +189,14 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
186189 try :
187190 output_file_without_ext = os .path .join (final_excel_dir , output_file )
188191 final_report = f"{ output_file_without_ext } { output_extension } "
189- if remove_src_data :
190- overwrite_excel (_output_dir , default_oss_name , "OSS Name" )
191- overwrite_excel (_output_dir , url , "Download Location" )
192- success , err_msg = merge_excels (_output_dir , final_report )
192+ if output_extension == ".xlsx" :
193+ if remove_src_data :
194+ overwrite_excel (_output_dir , default_oss_name , "OSS Name" )
195+ overwrite_excel (_output_dir , url , "Download Location" )
196+ success , err_msg = merge_excels (_output_dir , final_report )
197+ elif output_extension == ".yaml" :
198+ merge_yaml_files = [output_files ["SRC" ], output_files ["BIN" ], output_files ["DEP" ]]
199+ success , err_msg = merge_yamls (_output_dir , merge_yaml_files , final_report )
193200
194201 if success :
195202 result_log ["Output File" ] = final_report
0 commit comments