Skip to content

Commit e427b16

Browse files
committed
Fixed #124 - Prevent extract the same license from DJE multiple times
1 parent d2cabed commit e427b16

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

about_code_tool/genabout.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -371,17 +371,22 @@ def get_dje_license_list(self, gen_location, input_list, gen_license, dje_licens
371371

372372
def pre_process_and_dje_license_dict(self, input_list, api_url, api_username, api_key):
373373
key_text_dict = {}
374+
license_dict = {}
374375
for line in input_list:
375376
try:
376377
if line['dje_license']:
377-
detail_list = []
378-
detail = self.get_license_details_from_api(api_url, api_username, api_key, line['dje_license'])
379-
line['dje_license_name'] = detail[0]
380-
dje_key = detail[1]
381-
license_context = detail [2]
382-
detail_list.append(dje_key)
383-
detail_list.append(license_context)
384-
key_text_dict[line['dje_license_name']] = detail_list
378+
if not line['dje_license'] in license_dict:
379+
detail_list = []
380+
detail = self.get_license_details_from_api(api_url, api_username, api_key, line['dje_license'])
381+
license_dict[line['dje_license']] = detail[0]
382+
line['dje_license_name'] = detail[0]
383+
dje_key = detail[1]
384+
license_context = detail [2]
385+
detail_list.append(dje_key)
386+
detail_list.append(license_context)
387+
key_text_dict[line['dje_license_name']] = detail_list
388+
else:
389+
line['dje_license_name'] = license_dict[line['dje_license']]
385390
except Exception as e:
386391
self.warnings.append(Warn('dje_license', '',
387392
"Missing 'dje_license' for " + line['about_file']))

0 commit comments

Comments
 (0)