77import logging
88from fosslight_util .write_txt import write_txt_file
99from fosslight_util .constant import LOGGER_NAME
10- from fosslight_util .write_excel import hide_column
10+ from fosslight_util .write_excel import hide_column , write_cover_sheet
1111
1212logger = logging .getLogger (LOGGER_NAME )
1313HIDDEN_HEADER = ['TLSH' , 'SHA1' ]
1414
1515
16- def write_result_to_excel (out_file_name , row_list ):
16+ def write_result_to_excel (out_file_name , row_list , cover = '' ):
1717 header_row = ['ID' , 'Binary Name' , 'Source Code Path' , 'NOTICE.html' , 'OSS Name' , 'OSS Version' , 'License' ,
1818 'Download Location' , 'Homepage' ,
1919 'Copyright Text' ,
2020 'License Text' , 'Exclude' , 'Comment' , 'Need Check' , 'TLSH' , 'SHA1' ]
2121 sheet_name = "BIN (Android)"
2222 try :
2323 workbook = xlsxwriter .Workbook (out_file_name )
24+ if cover :
25+ write_cover_sheet (workbook , cover )
2426 worksheet = create_worksheet (workbook , sheet_name , header_row )
2527 write_result_to_sheet (worksheet , row_list )
2628 hide_column (worksheet , header_row , HIDDEN_HEADER )
@@ -45,7 +47,7 @@ def create_worksheet(workbook, sheet_name, header_row):
4547 return worksheet
4648
4749
48- def write_result_to_txt_and_excel (out_excel_file , final_bin_info , out_txt_file ):
50+ def write_result_to_txt_and_excel (out_excel_file , final_bin_info , out_txt_file , cover = '' ):
4951 excel_list = []
5052 final_str = ['Binary Name\t Source Code Path\t NOTICE.html\t OSS Name\t OSS Version\t License\t Need '
5153 'Check\t Comment\t tlsh\t checksum' ]
@@ -60,6 +62,6 @@ def write_result_to_txt_and_excel(out_excel_file, final_bin_info, out_txt_file):
6062 sys .exit (1 )
6163
6264 success , error_msg = write_txt_file (out_txt_file , '\n ' .join (final_str ))
63- write_result_to_excel (out_excel_file , excel_list )
65+ write_result_to_excel (out_excel_file , excel_list , cover )
6466 else :
6567 logger .warning ("Nothing is detected from the scanner so output file is not generated." )
0 commit comments