Skip to content

Commit c8cdca3

Browse files
authored
Merge pull request #3030 from nexB/early-summer-q3-license-updates2
Improve license detection with rules and licenses
2 parents 7d1a675 + c5bc4bd commit c8cdca3

File tree

378 files changed

+2561
-116
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

378 files changed

+2561
-116
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

foo.html

Lines changed: 35 additions & 0 deletions
Large diffs are not rendered by default.

ht.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from licensedcode.cache import get_index
2+
idx = get_index()
3+
file= "sample.license.txt"
4+
matches = idx.match(location=file)
5+
for match in matches:
6+
ht = match.get_highlighted_text()
7+
print(ht)

sample.license.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) Django Software Foundation and individual contributors.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification,
5+
are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice,
8+
this list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright
11+
notice, this list of FOOBAR conditions and the following disclaimer in the
12+
documentation and/or other materials provided with the distribution.
13+
14+
3. Neither the name of Django nor the names of its contributors may be used
15+
to endorse or promote products derived from this software without
16+
specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
22+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

src/licensedcode/data/licenses/anti-capitalist-1.4.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
key: anti-capitalist-1.4
22
short_name: ACSL v. 1.4
3-
name: ANTI-CAPITALIST SOFTWARE LICENSE (v 1.4)
3+
name: Anti-Capitalist Software License (v 1.4)
44
category: Free Restricted
55
owner: Everest Pipkin and Ramsey Nasser
66
homepage_url: https://anticapitalist.software/

src/licensedcode/data/licenses/app-s2p.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ key: app-s2p
22
short_name: App::s2p License
33
name: App::s2p License
44
category: Permissive
5-
owner: Unspecified
5+
owner: Fedora
6+
homepage_url: https://fedoraproject.org/wiki/Licensing/App-s2p
67
spdx_license_key: App-s2p
78
other_urls:
89
- https://fedoraproject.org/wiki/Licensing/App-s2p

src/licensedcode/data/licenses/bohl-0.2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ key: bohl-0.2
22
short_name: BOHL-0.2
33
name: The Balloon Open Hardware License v0.2
44
category: Permissive
5-
owner: The Balloon
5+
owner: iTechnic
66
spdx_license_key: LicenseRef-scancode-bohl-0.2
77
text_urls:
88
- https://web.archive.org/web/20140426215620/http://www.balloonboard.org/docs/Balloon_License_0v2.pdf

src/licensedcode/data/licenses/cc-by-nc-sa-2.0-fr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ key: cc-by-nc-sa-2.0-fr
22
language: fr
33
short_name: CC-BY-NC-SA-2.0-FR
44
name: Creative Commons Attribution-NonCommercial-ShareAlike 2.0 France
5-
category: Free Restricted
5+
category: Source-available
66
owner: Creative Commons
77
spdx_license_key: CC-BY-NC-SA-2.0-FR
88
other_urls:

src/licensedcode/data/licenses/cc-by-nc-sa-3.0-de.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ key: cc-by-nc-sa-3.0-de
22
language: de
33
short_name: CC-BY-NC-SA-3.0-DE
44
name: Creative Commons Attribution Non Commercial Share Alike 3.0 Germany
5-
category: Free Restricted
5+
category: Source-available
66
owner: Creative Commons
77
spdx_license_key: CC-BY-NC-SA-3.0-DE
88
other_urls:

src/licensedcode/data/licenses/cc-by-sa-1.0.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
key: cc-by-sa-1.0
22
short_name: CC-BY-SA-1.0
33
name: Creative Commons Attribution Share Alike License 1.0
4-
category: Permissive
4+
category: Copyleft Limited
55
owner: Creative Commons
66
homepage_url: http://creativecommons.org/licenses/by-sa/1.0/
77
spdx_license_key: CC-BY-SA-1.0

0 commit comments

Comments
 (0)