@@ -395,31 +395,16 @@ def get_dje_license_list(self, gen_location, input_list, gen_license, dje_licens
395395 license_file_list = []
396396 file_location = line ['about_file' ]
397397 about_parent_dir = dirname (file_location )
398- if '\n ' in line ['license_text_file' ]:
399- file_value = line ['license_text_file' ].split ('\n ' )
400- else :
401- file_value = [line ['license_text_file' ]]
402- for license_text_file in file_value :
403- license_file_list .append (normpath (gen_location .rpartition ('/' )[0 ] + join (about_parent_dir , license_text_file )))
404- for license_file in license_file_list :
405- if not _exists (license_file ):
406- self .errors .append (Error ('license_text_file' , license_file , "The 'license_text_file' does not exist." ))
398+ license_text_file = line ['license_text_file' ]
399+ license_file = normpath (gen_location .rpartition ('/' )[0 ] + join (about_parent_dir , license_text_file ))
400+ if not _exists (license_file ):
401+ self .errors .append (Error ('license_text_file' , license_file , "The 'license_text_file' does not exist." ))
407402 else :
408403 if gen_license :
409404 if line ['dje_license' ]:
410405 license_output_list .append (self .gen_license_list (line ))
411- license_names = []
412- if '\n ' in line ['dje_license_name' ]:
413- license_names = line ['dje_license_name' ].split ('\n ' )
414- else :
415- license_names = [line ['dje_license_name' ]]
416- for lic_name in license_names :
417- try :
418- if line ['license_text_file' ]:
419- line ['license_text_file' ] += '\n '
420- line ['license_text_file' ] += dje_license_dict [lic_name ][0 ] + '.LICENSE'
421- except :
422- line ['license_text_file' ] = dje_license_dict [lic_name ][0 ] + '.LICENSE'
406+ lic_name = line ['dje_license_name' ]
407+ line ['license_text_file' ] = dje_license_dict [lic_name ][0 ] + '.LICENSE'
423408 else :
424409 self .warnings .append (Warn ('dje_license' , '' ,
425410 "Missing 'dje_license' for " + line ['about_file' ]))
@@ -430,18 +415,9 @@ def get_dje_license_list(self, gen_location, input_list, gen_license, dje_licens
430415 if gen_license :
431416 if line ['dje_license' ]:
432417 license_output_list .append (self .gen_license_list (line ))
433- license_names = []
434- if '\n ' in line ['dje_license_name' ]:
435- license_names = line ['dje_license_name' ].split ('\n ' )
436- else :
437- license_names = [line ['dje_license_name' ]]
438-
439- for lic_name in license_names :
440- if 'license_text_file' in line :
441- line ['license_text_file' ] += '\n '
442- license_name = dje_license_dict [lic_name ][0 ]
443- license_text_file = license_name + '.LICENSE'
444- line ['license_text_file' ] = license_text_file
418+ lic_name = line ['dje_license_name' ]
419+ print (lic_name )
420+ line ['license_text_file' ] = dje_license_dict [lic_name ][0 ] + '.LICENSE'
445421 else :
446422 self .warnings .append (Warn ('dje_license' , '' ,
447423 "Missing 'dje_license' for " + line ['about_file' ]))
@@ -453,32 +429,25 @@ def pre_process_and_dje_license_dict(self, input_list, api_url, api_username, ap
453429 for line in input_list :
454430 try :
455431 if line ['dje_license' ]:
456- license_list = []
457432 if '\n ' in line ['dje_license' ]:
458- license_list = line ['dje_license' ].split ('\n ' )
433+ line ['dje_license_name' ] = ""
434+ self .errors .append (Error ('dje_license' ,
435+ line ['dje_license' ],
436+ "No multiple licenses or newline character are accepted." ))
437+ continue
438+ lic = line ['dje_license' ]
439+ if not lic in license_dict :
440+ detail_list = []
441+ detail = self .get_license_details_from_api (api_url , api_username , api_key , lic )
442+ license_dict [lic ] = detail [0 ]
443+ line ['dje_license_name' ] = detail [0 ]
444+ dje_key = detail [1 ]
445+ license_context = detail [2 ]
446+ detail_list .append (dje_key )
447+ detail_list .append (license_context )
448+ key_text_dict [detail [0 ]] = detail_list
459449 else :
460- license_list = [line ['dje_license' ]]
461- for lic in license_list :
462- if not lic in license_dict :
463- detail_list = []
464- detail = self .get_license_details_from_api (api_url , api_username , api_key , lic )
465- license_dict [lic ] = detail [0 ]
466- try :
467- if line ['dje_license_name' ]:
468- line ['dje_license_name' ] += "\n " + detail [0 ]
469- except :
470- line ['dje_license_name' ] = detail [0 ]
471- dje_key = detail [1 ]
472- license_context = detail [2 ]
473- detail_list .append (dje_key )
474- detail_list .append (license_context )
475- key_text_dict [detail [0 ]] = detail_list
476- else :
477- try :
478- if line ['dje_license_name' ]:
479- line ['dje_license_name' ] += "\n " + license_dict [lic ]
480- except :
481- line ['dje_license_name' ] = license_dict [lic ]
450+ line ['dje_license_name' ] = license_dict [lic ]
482451 except Exception :
483452 err = Warn ('dje_license' , '' ,
484453 'Missing "dje_license" for ' + line ['about_file' ])
@@ -488,14 +457,10 @@ def pre_process_and_dje_license_dict(self, input_list, api_url, api_username, ap
488457 def process_dje_licenses (self , dje_license_list , dje_license_dict , output_path ):
489458 license_list_context = []
490459 for gen_path , license_name in dje_license_list :
491- licenses = []
492- if '\n ' in license_name :
493- licenses = license_name .split ('\n ' )
494- else :
495- licenses = [license_name ]
460+ lic = license_name
496461 if gen_path .startswith ('/' ):
497462 gen_path = gen_path .partition ('/' )[2 ]
498- for lic in licenses :
463+ if lic :
499464 license_key = dje_license_dict [lic ][0 ]
500465 gen_license_path = join (output_path , gen_path , license_key ) + '.LICENSE'
501466 if not _exists (gen_license_path ) and not self .extract_dje_license_error :
0 commit comments