@@ -281,6 +281,8 @@ def copy_license_files(gen_location, license_list):
281281 def write_licenses (self , license_context_list ):
282282 for gen_license_path , license_context in license_context_list :
283283 try :
284+ if not _exists (dirname (gen_license_path )):
285+ makedirs (dirname (gen_license_path ))
284286 with open (gen_license_path , 'wb' ) as output :
285287 output .write (license_context )
286288 except Exception as e :
@@ -337,14 +339,18 @@ def get_dje_license_list(self, gen_location, input_list, gen_license):
337339 "Missing 'dje_license' for " + line ['about_file' ]))
338340 return license_output_list
339341
340- def pre_generation (self , gen_location , input_list , action_num , all_in_one , api_url , api_username , api_key ):
341- output_list = []
342+ def add_dje_license_name (self , input_list , api_url , api_username , api_key ):
342343 for line in input_list :
343344 try :
344- if api_url and line ['dje_license' ]:
345- line ['dje_license_name' ] = self .get_license_name_from_api (api_url , api_username , api_key , line ['dje_license' ])
345+ if line ['dje_license' ]:
346+ line ['dje_license_name' ] = self .get_license_name_from_api (api_url , api_username , api_key , line ['dje_license' ])
346347 except Exception as e :
347- pass
348+ self .warnings .append (Warn ('dje_license' , '' ,
349+ "Missing 'dje_license' for " + line ['about_file' ]))
350+
351+ def pre_generation (self , gen_location , input_list , action_num , all_in_one ):
352+ output_list = []
353+ for line in input_list :
348354 component_list = []
349355 file_location = line ['about_file' ]
350356 if file_location .startswith ('/' ):
@@ -658,8 +664,11 @@ def main(parser, options, args):
658664 print ("The input does not have the 'dje_license' key which is required." )
659665 sys .exit (errno .EINVAL )
660666
667+ if gen_license :
668+ gen .add_dje_license_name (input_list , api_url , api_username , api_key )
669+
661670 dje_license_list = gen .get_dje_license_list (output_path , input_list , gen_license )
662- components_list = gen .pre_generation (output_path , input_list , action_num , all_in_one , api_url , api_username , api_key )
671+ components_list = gen .pre_generation (output_path , input_list , action_num , all_in_one )
663672 formatted_output = gen .format_output (components_list )
664673 gen .write_output (formatted_output )
665674
0 commit comments