@@ -1643,7 +1643,7 @@ def save_as_excel(location, about_dicts):
16431643 formatted_list = util .format_about_dict_output (about_dicts )
16441644 write_excel (location , formatted_list )
16451645
1646- def pre_process_and_fetch_license_dict (abouts , api_url = None , api_key = None , scancode = False , reference = None ):
1646+ def pre_process_and_fetch_license_dict (abouts , from_check = False , api_url = None , api_key = None , scancode = False , reference = None ):
16471647 """
16481648 Return a dictionary containing the license information (key, name, text, url)
16491649 fetched from the ScanCode LicenseDB or DejaCode API.
@@ -1710,9 +1710,13 @@ def pre_process_and_fetch_license_dict(abouts, api_url=None, api_key=None, scanc
17101710 if msg == "Invalid '--api_url'. License generation is skipped." :
17111711 errors .extend (errs )
17121712 return key_text_dict , errors
1713- for severity , message in errs :
1713+ for severity , message in errs :
17141714 msg = (about .about_file_path + ": " + message )
17151715 errors .append (Error (severity , msg ))
1716+ # We don't want to actually get the license information from the
1717+ # check utility
1718+ if from_check :
1719+ continue
17161720 if not license_data :
17171721 continue
17181722 license_name = license_data .get ('short_name' , '' )
@@ -1725,6 +1729,10 @@ def pre_process_and_fetch_license_dict(abouts, api_url=None, api_key=None, scanc
17251729 license_text_url = url + lic_key + '.LICENSE'
17261730 try :
17271731 json_url = urlopen (license_url )
1732+ # We don't want to actually get the license information from the
1733+ # check utility
1734+ if from_check :
1735+ continue
17281736 data = json .loads (json_url .read ())
17291737 license_name = data ['short_name' ]
17301738 license_text = urllib .request .urlopen (license_text_url ).read ().decode ('utf-8' )
@@ -1738,12 +1746,13 @@ def pre_process_and_fetch_license_dict(abouts, api_url=None, api_key=None, scanc
17381746 msg = u"Invalid 'license': " + lic_key
17391747 errors .append (Error (ERROR , msg ))
17401748 continue
1741- detail_list .append (license_name )
1742- detail_list .append (license_filename )
1743- detail_list .append (license_text )
1744- detail_list .append (lic_url )
1745- detail_list .append (spdx_license_key )
1746- key_text_dict [lic_key ] = detail_list
1749+ if not from_check :
1750+ detail_list .append (license_name )
1751+ detail_list .append (license_filename )
1752+ detail_list .append (license_text )
1753+ detail_list .append (lic_url )
1754+ detail_list .append (spdx_license_key )
1755+ key_text_dict [lic_key ] = detail_list
17471756 if not about .license_key .value :
17481757 about .license_key .value = lic_list
17491758
0 commit comments