99import os
1010import re
1111import json
12- import getopt
1312import logging
1413# Parsing NOTICE
1514from bs4 import BeautifulSoup
5453from fosslight_util .constant import LOGGER_NAME
5554from fosslight_binary .binary_analysis import return_bin_only
5655import argparse
57- import glob
5856from pathlib import Path
5957
6058EXCEPTIONAL_PATH = [r"(/)+gen/META/lic_intermediates/" ]
@@ -141,15 +139,15 @@ def get_module_json_obj_by_installed_path(module_name, binary_name_with_path, bi
141139
142140 js_value = ""
143141
144- if module_name in module_info_json_obj : # Binary Name without extension
142+ if module_name in module_info_json_obj : # Binary Name without extension
145143 js_value = module_info_json_obj [module_name ]
146144 js_value [MODULE_TYPE_NAME ] = module_name
147145 return js_value
148- elif binary_name_only in module_info_json_obj : # Binary Name
146+ elif binary_name_only in module_info_json_obj : # Binary Name
149147 js_value = module_info_json_obj [binary_name_only ]
150148 js_value [MODULE_TYPE_NAME ] = binary_name_only
151149 return js_value
152- else : # Find binary by installed path
150+ else : # Find binary by installed path
153151 for key in module_info_json_obj :
154152 js_value = module_info_json_obj [key ]
155153 output_files = js_value ["installed" ]
@@ -330,7 +328,7 @@ def find_notice_value():
330328 global notice_file_list , final_bin_info
331329
332330 try :
333- notice_file_list , notice_files = read_notice_file (os .path .abspath (build_out_notice_file_path ), NOTICE_HTML_FILE_NAME )
331+ notice_file_list , notice_files = read_notice_file (os .path .abspath (build_out_notice_file_path ), NOTICE_HTML_FILE_NAME )
334332 if not notice_file_list :
335333 logger .info (f"Notice file is empty:{ notice_files } " )
336334 return
@@ -341,7 +339,7 @@ def find_notice_value():
341339 return_list = do_multi_process (find_notice_html , final_bin_info )
342340 final_bin_info = return_list [:]
343341
344- except IOError as error : # 'CANNOT_FIND_NOTICE_HTML'
342+ except IOError as error : # 'CANNOT_FIND_NOTICE_HTML'
345343 logger .debug (f"find_notice_value:{ error } " )
346344
347345
@@ -643,7 +641,7 @@ def remove_duplicated_binaries_by_checking_checksum(remove_list_file):
643641 checked_file_name [search_key ] = find_result
644642
645643 if find_result :
646- final_added = "" # finally added binary
644+ final_added = "" # finally added binary
647645 # 0 : file in system folder, 1: Source Path exists, 2:exist in NOTICE.html, 3: shortest path
648646 priority = ["" , "" , "" , "" ]
649647 idx_notice = 2
@@ -764,8 +762,6 @@ def main():
764762 _NOTICE_CHECKLIST_TYPE = False
765763 analyze_source = False
766764
767- argv = sys .argv [1 :]
768-
769765 num_cores = multiprocessing .cpu_count () - 1
770766 if num_cores < 1 :
771767 num_cores = 1
@@ -786,7 +782,7 @@ def main():
786782 parser .add_argument ('-n' , '--notice' , type = str , required = False )
787783 parser .add_argument ('-t' , '--toadd' , action = 'store_true' , required = False )
788784 parser .add_argument ('-m' , '--more' , action = 'store_true' , required = False )
789- parser .add_argument ('-c' , '--check' ,type = str , required = False )
785+ parser .add_argument ('-c' , '--check' , type = str , required = False )
790786 parser .add_argument ('-a' , '--android' , type = str , required = False )
791787 parser .add_argument ('-f' , '--find' , action = 'store_true' , required = False )
792788 parser .add_argument ('-i' , '--ignore' , action = 'store_true' , required = False )
@@ -799,9 +795,9 @@ def main():
799795 print_help_msg ()
800796 if args .version :
801797 print_version (PKG_NAME )
802- if args .source : # android source path
798+ if args .source : # android source path
803799 os .chdir (args .source )
804- if args .binary : # Base model's binary.txt to exclude
800+ if args .binary : # Base model's binary.txt to exclude
805801 base_binary_txt = args .binary
806802 if args .notice :
807803 NOTICE_HTML_FILE_NAME = args .notice
0 commit comments