@@ -97,7 +97,7 @@ def check_newline_in_file_field(component):
9797 try :
9898 if '\n ' in component [k ]:
9999 msg = ("New line character detected in '%s' for '%s' which is not supported."
100- "\n Please use ',' to declare multiple files." ) % (k , component ['about_resource' ])
100+ "\n Please use ',' to declare multiple files." ) % (k , component ['about_resource' ])
101101 errors .append (Error (CRITICAL , msg ))
102102 except :
103103 pass
@@ -111,7 +111,7 @@ def check_about_resource_filename(arp):
111111 """
112112 if invalid_chars (arp ):
113113 msg = ("Invalid characters present in 'about_resource' "
114- "field: " + arp )
114+ "field: " + arp )
115115 return (Error (ERROR , msg ))
116116 return ''
117117
@@ -185,7 +185,8 @@ def load_inventory(location, from_attrib=False, base_dir=None, scancode=False, r
185185 if from_attrib and f == 'about_resource' :
186186 continue
187187 else :
188- msg = "Required field: %(f)r not found in the <input>" % locals ()
188+ msg = "Required field: %(f)r not found in the <input>" % locals (
189+ )
189190 errors .append (Error (CRITICAL , msg ))
190191 return errors , abouts
191192 # Set about file path to '' if no 'about_resource' is provided from
@@ -238,19 +239,9 @@ def load_inventory(location, from_attrib=False, base_dir=None, scancode=False, r
238239
239240 abouts .append (about )
240241 if custom_fields_list :
241- custom_fields_err_msg = 'Field ' + str (custom_fields_list ) + ' is a custom field.'
242+ custom_fields_err_msg = 'Field ' + \
243+ str (custom_fields_list ) + ' is a custom field.'
242244 errors .append (Error (INFO , custom_fields_err_msg ))
243- # Covert the license_score value from string to list of int
244- # The licesne_score is not in the spec but is specify in the scancode license scan.
245- # This key will be treated as a custom string field. Therefore, we need to
246- # convert back to the list with float type for score.
247- if scancode :
248- for about in abouts :
249- try :
250- score_list = list (map (float , about .license_score .value .replace ('[' , '' ).replace (']' , '' ).split (',' )))
251- about .license_score .value = score_list
252- except :
253- pass
254245
255246 return errors , abouts
256247
@@ -259,7 +250,7 @@ def update_about_resource(self):
259250 pass
260251
261252
262- def generate (location , base_dir , android = None , reference_dir = None , fetch_license = False , fetch_license_djc = False , worksheet = None ):
253+ def generate (location , base_dir , android = None , reference_dir = None , fetch_license = False , fetch_license_djc = False , scancode = False , worksheet = None ):
263254 """
264255 Load ABOUT data from a CSV inventory at `location`. Write ABOUT files to
265256 base_dir. Return errors and about objects.
@@ -287,11 +278,13 @@ def generate(location, base_dir, android=None, reference_dir=None, fetch_license
287278 location = location ,
288279 base_dir = bdir ,
289280 reference_dir = reference_dir ,
281+ scancode = scancode ,
290282 worksheet = worksheet
291283 )
292284
293285 if gen_license :
294- license_dict , err = model .pre_process_and_fetch_license_dict (abouts , api_url , api_key )
286+ license_dict , err = model .pre_process_and_fetch_license_dict (
287+ abouts , api_url , api_key )
295288 if err :
296289 for e in err :
297290 # Avoid having same error multiple times
@@ -337,7 +330,8 @@ def generate(location, base_dir, android=None, reference_dir=None, fetch_license
337330 # be validated when creating the about object
338331 loc = util .to_posix (dump_loc )
339332 about_file_loc = loc
340- path = join (dirname (util .to_posix (about_file_loc )), about_resource_value )
333+ path = join (dirname (util .to_posix (about_file_loc )),
334+ about_resource_value )
341335 if not exists (path ):
342336 path = util .to_posix (path .strip (UNC_PREFIX_POSIX ))
343337 path = normpath (path )
@@ -349,10 +343,12 @@ def generate(location, base_dir, android=None, reference_dir=None, fetch_license
349343 licenses_dict = {}
350344 if gen_license :
351345 # Write generated LICENSE file
352- license_key_name_context_url_list = about .dump_lic (dump_loc , license_dict )
346+ license_key_name_context_url_list = about .dump_lic (
347+ dump_loc , license_dict )
353348 if license_key_name_context_url_list :
354349 for lic_key , lic_name , lic_filename , lic_context , lic_url , spdx_lic_key in license_key_name_context_url_list :
355- licenses_dict [lic_key ] = [lic_name , lic_filename , lic_context , lic_url , spdx_lic_key ]
350+ licenses_dict [lic_key ] = [
351+ lic_name , lic_filename , lic_context , lic_url , spdx_lic_key ]
356352 if not lic_name in about .license_name .value :
357353 about .license_name .value .append (lic_name )
358354 about .license_file .value [lic_filename ] = lic_filename
0 commit comments