Skip to content

Commit e6f75c5

Browse files
committed
Try syncing notes too
And format code. Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent d9c22fd commit e6f75c5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

etc/scripts/licenses/synclic.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ class DejaSource(ExternalLicensesSource):
530530
"is_deprecated",
531531
"is_exception",
532532
# not yet
533+
# "notes",
533534
# "standard_notice",
534535
)
535536
non_updatable_attributes = ("notes",)
@@ -601,6 +602,8 @@ def build_license(self, mapping, *args, **kwargs):
601602
key = mapping["key"]
602603
standard_notice = mapping.get("standard_notice") or ""
603604
standard_notice = clean_text(standard_notice)
605+
# notes = mapping.get("reference_notes") or ""
606+
# notes = clean_text(notes)
604607

605608
deprecated = not mapping.get("is_active")
606609
spdx_license_key = mapping.get("spdx_license_key") or None
@@ -629,6 +632,7 @@ def build_license(self, mapping, *args, **kwargs):
629632
is_exception=mapping.get("is_exception", False),
630633
is_deprecated=deprecated,
631634
standard_notice=standard_notice,
635+
# notes=notes,
632636
)
633637
text = mapping["full_text"] or ""
634638
# normalize EOL to POSIX
@@ -994,6 +998,7 @@ def update_external(_attrib, _sc_val, _ext_val):
994998
update_scancode(attrib, scancode_value, external_value)
995999
continue
9961000

1001+
# We merge sequences
9971002
if isinstance(scancode_value, (list, tuple)) and isinstance(external_value, (list, tuple)):
9981003
normalized_scancode_value = set(s for s in scancode_value if s and s.strip())
9991004
normalize_external_value = set(s for s in external_value if s and s.strip())
@@ -1034,8 +1039,7 @@ def update_external(_attrib, _sc_val, _ext_val):
10341039
continue
10351040

10361041
if isinstance(scancode_value, str) and isinstance(external_value, str):
1037-
# keep the stripped and normalized spaces value
1038-
# normalized spaces
1042+
# make value stripped and with normalized spaces
10391043
normalized_scancode_value = " ".join(scancode_value.split())
10401044
normalize_external_value = " ".join(external_value.split())
10411045

@@ -1165,9 +1169,9 @@ def synchronize_licenses(
11651169

11661170
# the matching key exists on both sides: merge/update both licenses
11671171
scancode_updated, external_updated = merge_licenses(
1168-
scancode_license,
1169-
external_license,
1170-
external_source.updatable_attributes,
1172+
scancode_license=scancode_license,
1173+
external_license=external_license,
1174+
updatable_attributes=external_source.updatable_attributes,
11711175
from_spdx=use_spdx_key,
11721176
)
11731177

0 commit comments

Comments
 (0)