Skip to content

Commit cbad6dd

Browse files
pdunajrlubos
authored andcommitted
scripts: sbom: Fix directory interface change in scancode
Get licenses from the new place. Signed-off-by: Pawel Dunaj <[email protected]>
1 parent fd10013 commit cbad6dd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

scripts/west_commands/sbom/scancode_toolkit_detector.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,17 @@ def detect(data: Data, optional: bool):
6464
decoded = map(run_scancode, filtered)
6565

6666
for result, file in zip(decoded, filtered):
67-
for i in result['files'][0]['licenses']:
67+
68+
current = result['files'][0]
69+
if 'licenses' in current:
70+
licenses = result['files'][0]['licenses']
71+
elif 'license_detections' in current:
72+
licenses = result['files'][0]['license_detections']
73+
else:
74+
print('No license information for {}'.format(current['path']))
75+
continue
76+
77+
for i in licenses:
6878

6979
friendly_id = ''
7080
if 'spdx_license_key' in i and i['spdx_license_key'] != '':

0 commit comments

Comments
 (0)