@@ -269,8 +269,7 @@ def present_license_file(path_to_find, lic):
269269 file_name = f"{ lic } .txt"
270270 if file_name in os .listdir (lic_file_path ):
271271 present = True
272- logger .info (f"{ os .path .join (path_to_find , 'LICENSES' , file_name )} already exists." )
273- return present
272+ return present
274273
275274
276275def find_representative_license (path_to_find , input_license ):
@@ -290,35 +289,33 @@ def find_representative_license(path_to_find, input_license):
290289
291290 for file in files :
292291 file_lower_case = file .lower ()
293-
294292 if file_lower_case in LICENSE_INCLUDE_FILES or file_lower_case .startswith ("license" ) or file_lower_case .startswith ("notice" ):
295293 found_file .append (file )
296294 found_license_file = True
297295
298- if found_license_file :
299- logger .info (f"# Found representative license file : { found_file } " )
300- else :
301- logger .info ("# There is no representative license file" )
302- input_license = check_input_license_format (input_license )
303- logger .info (f" - Input License : { input_license } " )
304-
305- parsed_args = main_parser .parse_args (['download' , f"{ input_license } " ])
306-
307- try :
308- # 0: successfully downloaded, 1: failed to download
309- reuse_return_code = reuse_download (parsed_args , prj )
310- # Check if the license text file is present
311- present_lic = present_license_file (path_to_find , input_license )
296+ input_license = check_input_license_format (input_license )
297+ logger .info (f" - Input License : { input_license } " )
312298
313- if reuse_return_code == 1 and not present_lic :
314- success_from_lge = lge_lic_download (path_to_find , input_license )
299+ parsed_args = main_parser .parse_args (['download' , f"{ input_license } " ])
315300
316- if reuse_return_code == 0 or success_from_lge or present_lic :
317- logger .warning (f"# Created Representative License File : { input_license } .txt" )
301+ try :
302+ # 0: successfully downloaded, 1: failed to download
303+ reuse_return_code = reuse_download (parsed_args , prj )
304+ # Check if the license text file is present
305+ present_lic = present_license_file (path_to_find , input_license )
306+
307+ if reuse_return_code == 1 and not present_lic :
308+ # True : successfully downloaded from LGE
309+ success_from_lge = lge_lic_download (path_to_find , input_license )
310+
311+ if reuse_return_code == 0 or success_from_lge :
312+ if found_license_file :
313+ logger .info (f"# Found representative license file : { found_file } \n " )
314+ else :
315+ logger .warning (f"# Created Representative License File : { input_license } .txt\n " )
318316 copy_to_root (path_to_find , input_license )
319-
320- except Exception as ex :
321- dump_error_msg (f"Error - download representative license text: { ex } " )
317+ except Exception as ex :
318+ dump_error_msg (f"Error - download representative license text: { ex } " )
322319
323320
324321def is_exclude_dir (dir_path ):
0 commit comments