Skip to content

Commit c2095e2

Browse files
authored
Merge pull request #137 from fosslight/bin
Do not add item if None
2 parents 727d69f + 00f835e commit c2095e2

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/fosslight_util/write_scancodejson.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@ def write_scancodejson(output_dir, output_filename, oss_list):
3535

3636

3737
def append_oss_item_in_filesitem(item, files_item):
38-
oss_item = {}
39-
oss_item['name'] = item.name
40-
oss_item['version'] = item.version
41-
oss_item['license'] = item.license
42-
oss_item['copyright'] = item.copyright
43-
oss_item['download_location'] = item.download_location
44-
oss_item['comment'] = item.comment
4538
if item.is_binary:
4639
files_item['is_binary'] = item.is_binary
47-
files_item['oss'].append(oss_item)
40+
if item.name or item.version or item.license or item.copyright or item.download_location or item.comment:
41+
oss_item = {}
42+
oss_item['name'] = item.name
43+
oss_item['version'] = item.version
44+
oss_item['license'] = item.license
45+
oss_item['copyright'] = item.copyright
46+
oss_item['download_location'] = item.download_location
47+
oss_item['comment'] = item.comment
48+
files_item['oss'].append(oss_item)
4849
return files_item
4950

5051

0 commit comments

Comments
 (0)