fosslight-source 2.1.9__py3-none-any.whl → 2.1.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fosslight_source/_parsing_scancode_file_item.py +46 -5
- fosslight_source/_scan_item.py +9 -3
- fosslight_source/cli.py +0 -1
- {fosslight_source-2.1.9.dist-info → fosslight_source-2.1.11.dist-info}/METADATA +7 -13
- fosslight_source-2.1.11.dist-info/RECORD +16 -0
- {fosslight_source-2.1.9.dist-info → fosslight_source-2.1.11.dist-info}/entry_points.txt +0 -1
- fosslight_source-2.1.9.dist-info/RECORD +0 -16
- {fosslight_source-2.1.9.dist-info → fosslight_source-2.1.11.dist-info}/LICENSE +0 -0
- {fosslight_source-2.1.9.dist-info → fosslight_source-2.1.11.dist-info}/WHEEL +0 -0
- {fosslight_source-2.1.9.dist-info → fosslight_source-2.1.11.dist-info}/top_level.txt +0 -0
|
@@ -13,6 +13,7 @@ from ._scan_item import is_exclude_dir
|
|
|
13
13
|
from ._scan_item import is_exclude_file
|
|
14
14
|
from ._scan_item import replace_word
|
|
15
15
|
from ._scan_item import is_notice_file
|
|
16
|
+
from ._scan_item import is_manifest_file
|
|
16
17
|
from typing import Tuple
|
|
17
18
|
|
|
18
19
|
logger = logging.getLogger(constant.LOGGER_NAME)
|
|
@@ -29,6 +30,27 @@ KEYWORD_SCANCODE_UNKNOWN = "unknown-spdx"
|
|
|
29
30
|
SPDX_REPLACE_WORDS = ["(", ")"]
|
|
30
31
|
KEY_AND = r"(?<=\s)and(?=\s)"
|
|
31
32
|
KEY_OR = r"(?<=\s)or(?=\s)"
|
|
33
|
+
GPL_LICENSE_PATTERN = r'((a|l)?gpl|gfdl)' # GPL, LGPL, AGPL, GFDL
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def is_gpl_family_license(licenses: list) -> bool:
|
|
37
|
+
if not licenses:
|
|
38
|
+
return False
|
|
39
|
+
|
|
40
|
+
for license_name in licenses:
|
|
41
|
+
if not license_name:
|
|
42
|
+
continue
|
|
43
|
+
|
|
44
|
+
license_lower = license_name.lower()
|
|
45
|
+
if re.search(GPL_LICENSE_PATTERN, license_lower):
|
|
46
|
+
logger.debug(f"GPL family license detected: {license_name}")
|
|
47
|
+
return True
|
|
48
|
+
|
|
49
|
+
return False
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def should_remove_copyright_for_gpl_license_text(licenses: list, is_license_text: bool) -> bool:
|
|
53
|
+
return is_license_text and is_gpl_family_license(licenses)
|
|
32
54
|
|
|
33
55
|
|
|
34
56
|
def get_error_from_header(header_item: list) -> Tuple[bool, str]:
|
|
@@ -99,8 +121,6 @@ def parsing_scancode_32_earlier(scancode_file_list: list, has_error: bool = Fals
|
|
|
99
121
|
pass
|
|
100
122
|
copyright_value_list.append(copyright_data)
|
|
101
123
|
|
|
102
|
-
result_item.copyright = copyright_value_list
|
|
103
|
-
|
|
104
124
|
# Set the license value
|
|
105
125
|
license_detected = []
|
|
106
126
|
if licenses is None or licenses == "":
|
|
@@ -164,6 +184,16 @@ def parsing_scancode_32_earlier(scancode_file_list: list, has_error: bool = Fals
|
|
|
164
184
|
if len(license_detected) > 0:
|
|
165
185
|
result_item.licenses = license_detected
|
|
166
186
|
|
|
187
|
+
if is_manifest_file(file_path):
|
|
188
|
+
result_item.is_license_text = True
|
|
189
|
+
|
|
190
|
+
# Remove copyright info for license text file of GPL family
|
|
191
|
+
if should_remove_copyright_for_gpl_license_text(license_detected, result_item.is_license_text):
|
|
192
|
+
logger.debug(f"Removing copyright for GPL family license text file: {file_path}")
|
|
193
|
+
result_item.copyright = []
|
|
194
|
+
else:
|
|
195
|
+
result_item.copyright = copyright_value_list
|
|
196
|
+
|
|
167
197
|
if len(license_expression_list) > 0:
|
|
168
198
|
license_expression_list = list(
|
|
169
199
|
set(license_expression_list))
|
|
@@ -223,7 +253,6 @@ def parsing_scancode_32_later(
|
|
|
223
253
|
except Exception:
|
|
224
254
|
pass
|
|
225
255
|
copyright_value_list.append(copyright_data)
|
|
226
|
-
result_item.copyright = copyright_value_list
|
|
227
256
|
|
|
228
257
|
license_detected = []
|
|
229
258
|
licenses = file.get("license_detections", [])
|
|
@@ -259,6 +288,20 @@ def parsing_scancode_32_later(
|
|
|
259
288
|
license_list[lic_matched_key] = lic_info
|
|
260
289
|
license_detected.append(found_lic)
|
|
261
290
|
result_item.licenses = license_detected
|
|
291
|
+
|
|
292
|
+
result_item.exclude = is_exclude_file(file_path)
|
|
293
|
+
result_item.is_license_text = file.get("percentage_of_license_text", 0) > 90 or is_notice_file(file_path)
|
|
294
|
+
|
|
295
|
+
if is_manifest_file(file_path) and len(license_detected) > 0:
|
|
296
|
+
result_item.is_license_text = True
|
|
297
|
+
|
|
298
|
+
# Remove copyright info for license text file of GPL family
|
|
299
|
+
if should_remove_copyright_for_gpl_license_text(license_detected, result_item.is_license_text):
|
|
300
|
+
logger.debug(f"Removing copyright for GPL family license text file: {file_path}")
|
|
301
|
+
result_item.copyright = []
|
|
302
|
+
else:
|
|
303
|
+
result_item.copyright = copyright_value_list
|
|
304
|
+
|
|
262
305
|
if len(license_detected) > 1:
|
|
263
306
|
license_expression_spdx = file.get("detected_license_expression_spdx", "")
|
|
264
307
|
license_expression = file.get("detected_license_expression", "")
|
|
@@ -267,8 +310,6 @@ def parsing_scancode_32_later(
|
|
|
267
310
|
if license_expression:
|
|
268
311
|
result_item.comment = license_expression
|
|
269
312
|
|
|
270
|
-
result_item.exclude = is_exclude_file(file_path)
|
|
271
|
-
result_item.is_license_text = file.get("percentage_of_license_text", 0) > 90 or is_notice_file(file_path)
|
|
272
313
|
scancode_file_item.append(result_item)
|
|
273
314
|
except Exception as ex:
|
|
274
315
|
msg.append(f"Error Parsing item: {ex}")
|
fosslight_source/_scan_item.py
CHANGED
|
@@ -14,6 +14,7 @@ replace_word = ["-only", "-old-style", "-or-later", "licenseref-scancode-", "lic
|
|
|
14
14
|
_notice_filename = ['licen[cs]e[s]?', 'notice[s]?', 'legal', 'copyright[s]?', 'copying*', 'patent[s]?', 'unlicen[cs]e', 'eula',
|
|
15
15
|
'[a,l]?gpl[-]?[1-3]?[.,-,_]?[0-1]?', 'mit', 'bsd[-]?[0-4]?', 'bsd[-]?[0-4][-]?clause[s]?',
|
|
16
16
|
'apache[-,_]?[1-2]?[.,-,_]?[0-2]?']
|
|
17
|
+
_manifest_filename = [r'.*\.pom$', r'package\.json$', r'setup\.py$', r'pubspec\.yaml$', r'.*\.podspec$', r'Cargo\.toml$']
|
|
17
18
|
_exclude_filename = ["changelog", "config.guess", "config.sub", "changes", "ltmain.sh",
|
|
18
19
|
"configure", "configure.ac", "depcomp", "compile", "missing", "makefile"]
|
|
19
20
|
_exclude_extension = [".m4", ".in", ".po"]
|
|
@@ -96,7 +97,7 @@ class SourceItem(FileItem):
|
|
|
96
97
|
return print_rows
|
|
97
98
|
|
|
98
99
|
def __eq__(self, other: object) -> bool:
|
|
99
|
-
if
|
|
100
|
+
if isinstance(other, str):
|
|
100
101
|
return self.source_name_or_path == other
|
|
101
102
|
else:
|
|
102
103
|
return self.source_name_or_path == other.source_name_or_path
|
|
@@ -137,6 +138,11 @@ def is_exclude_file(file_path: str, prev_dir: str = None, prev_dir_exclude_value
|
|
|
137
138
|
|
|
138
139
|
def is_notice_file(file_path: str) -> bool:
|
|
139
140
|
pattern = r"({})(?<!w)".format("|".join(_notice_filename))
|
|
140
|
-
file_path = file_path.lower()
|
|
141
141
|
filename = os.path.basename(file_path)
|
|
142
|
-
return bool(re.match(pattern, filename))
|
|
142
|
+
return bool(re.match(pattern, filename, re.IGNORECASE))
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def is_manifest_file(file_path: str) -> bool:
|
|
146
|
+
pattern = r"({})$".format("|".join(_manifest_filename))
|
|
147
|
+
filename = os.path.basename(file_path)
|
|
148
|
+
return bool(re.match(pattern, filename, re.IGNORECASE))
|
fosslight_source/cli.py
CHANGED
|
@@ -1,32 +1,28 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fosslight-source
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.11
|
|
4
4
|
Summary: FOSSLight Source Scanner
|
|
5
5
|
Home-page: https://github.com/fosslight/fosslight_source_scanner
|
|
6
|
+
Download-URL: https://github.com/fosslight/fosslight_source_scanner
|
|
6
7
|
Author: LG Electronics
|
|
7
8
|
License: Apache-2.0
|
|
8
|
-
Download-URL: https://github.com/fosslight/fosslight_source_scanner
|
|
9
|
-
Platform: UNKNOWN
|
|
10
9
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
10
|
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
14
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
15
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
-
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Requires-Python: >=3.10, <3.13
|
|
17
15
|
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
18
17
|
Requires-Dist: pyparsing
|
|
19
|
-
Requires-Dist: scanoss
|
|
18
|
+
Requires-Dist: scanoss>=1.18.0
|
|
20
19
|
Requires-Dist: XlsxWriter
|
|
21
20
|
Requires-Dist: fosslight-util>=2.1.10
|
|
22
21
|
Requires-Dist: PyYAML
|
|
23
22
|
Requires-Dist: wheel>=0.38.1
|
|
24
23
|
Requires-Dist: intbitset
|
|
25
24
|
Requires-Dist: fosslight-binary>=5.0.0
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Requires-Dist: beautifulsoup4==4.12.*
|
|
28
|
-
Requires-Dist: scancode-toolkit==32.2.*; sys_platform != "darwin"
|
|
29
|
-
Requires-Dist: scancode-toolkit==32.0.*; sys_platform == "darwin"
|
|
25
|
+
Requires-Dist: scancode-toolkit
|
|
30
26
|
|
|
31
27
|
<!--
|
|
32
28
|
Copyright (c) 2021 LG Electronics
|
|
@@ -73,5 +69,3 @@ Please see the [CONTRIBUTING guide](https://fosslight.org/hub-guide-en/contribut
|
|
|
73
69
|
FOSSLight Source Scanner is Apache-2.0, as found in the [LICENSE][l] file.
|
|
74
70
|
|
|
75
71
|
[l]: https://github.com/fosslight/fosslight_source_scanner/blob/main/LICENSE
|
|
76
|
-
|
|
77
|
-
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
fosslight_source/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
fosslight_source/_help.py,sha256=q3eKABhBrz8hvWSvmLVszStNpL18TCYLnUuefaU4V-M,2013
|
|
3
|
+
fosslight_source/_license_matched.py,sha256=-3H881XQjFDafRttBsuboS3VbCPYEvPH1pwWXptknE4,2164
|
|
4
|
+
fosslight_source/_parsing_scancode_file_item.py,sha256=w7-oX02gtpQ1oafeRK2hYDBsVBZ16rjkM91lc5GKY7c,15162
|
|
5
|
+
fosslight_source/_parsing_scanoss_file.py,sha256=IgqLf9cufc9qTLtdr_t1JSs8lRsCC4utlvpogAMtryg,4214
|
|
6
|
+
fosslight_source/_scan_item.py,sha256=Y13SRq3PCeHvzqZonGphkt9X1LXqmdWgYnnBI1QT8n8,5997
|
|
7
|
+
fosslight_source/cli.py,sha256=2TuHZvDKUp8R12DM9gesTF23RT7OBw968AdzNLtVanU,16650
|
|
8
|
+
fosslight_source/run_scancode.py,sha256=leq-FuGwX-kBg-sNZXQ-DSKy-uTj7w2QBFeOLgyvPxc,7094
|
|
9
|
+
fosslight_source/run_scanoss.py,sha256=8wu3sa-YBqjfb5x2dbDJuAdw3rrExueOW23WdzqDCaU,5721
|
|
10
|
+
fosslight_source/run_spdx_extractor.py,sha256=Hr9sTv06cJaVITy8amwexIW2FV8_rUcFw6hKmR9ZYws,1990
|
|
11
|
+
fosslight_source-2.1.11.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
12
|
+
fosslight_source-2.1.11.dist-info/METADATA,sha256=AVk1oM8tvIjN1nA5CXBLFLAbDrSIn98J8fnoXp77PnU,3219
|
|
13
|
+
fosslight_source-2.1.11.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
14
|
+
fosslight_source-2.1.11.dist-info/entry_points.txt,sha256=G4bBRWqSrJ68g-2M-JtNDrSZsdym_M7_KohQ2qR1vG8,113
|
|
15
|
+
fosslight_source-2.1.11.dist-info/top_level.txt,sha256=C2vw-0OIent84Vq-UEk1gt_kK1EL8dIItzBzp3WNyA4,17
|
|
16
|
+
fosslight_source-2.1.11.dist-info/RECORD,,
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
fosslight_source/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
fosslight_source/_help.py,sha256=q3eKABhBrz8hvWSvmLVszStNpL18TCYLnUuefaU4V-M,2013
|
|
3
|
-
fosslight_source/_license_matched.py,sha256=-3H881XQjFDafRttBsuboS3VbCPYEvPH1pwWXptknE4,2164
|
|
4
|
-
fosslight_source/_parsing_scancode_file_item.py,sha256=4U8wTuuNm-2-hanTxiQr2FvHTBrf2ZwESyea_E8caHU,13466
|
|
5
|
-
fosslight_source/_parsing_scanoss_file.py,sha256=IgqLf9cufc9qTLtdr_t1JSs8lRsCC4utlvpogAMtryg,4214
|
|
6
|
-
fosslight_source/_scan_item.py,sha256=2RdnH5ZvrD7yjGxaHAIgSLmhq0dyW1379RScqPYJtOI,5679
|
|
7
|
-
fosslight_source/cli.py,sha256=mF5F1vCfiMLeL700r-grhFAG-rGS4_xisDCnrJFHxic,16668
|
|
8
|
-
fosslight_source/run_scancode.py,sha256=leq-FuGwX-kBg-sNZXQ-DSKy-uTj7w2QBFeOLgyvPxc,7094
|
|
9
|
-
fosslight_source/run_scanoss.py,sha256=8wu3sa-YBqjfb5x2dbDJuAdw3rrExueOW23WdzqDCaU,5721
|
|
10
|
-
fosslight_source/run_spdx_extractor.py,sha256=Hr9sTv06cJaVITy8amwexIW2FV8_rUcFw6hKmR9ZYws,1990
|
|
11
|
-
fosslight_source-2.1.9.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
12
|
-
fosslight_source-2.1.9.dist-info/METADATA,sha256=rUZvUd4aFN3CQxSrtzlkzjMRbKF9sHV0VowlfohD26I,3442
|
|
13
|
-
fosslight_source-2.1.9.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
14
|
-
fosslight_source-2.1.9.dist-info/entry_points.txt,sha256=NzFURHC4L8uf1PmnZ2uGQcZxR7UbYCgjetb_9aPHV-w,114
|
|
15
|
-
fosslight_source-2.1.9.dist-info/top_level.txt,sha256=C2vw-0OIent84Vq-UEk1gt_kK1EL8dIItzBzp3WNyA4,17
|
|
16
|
-
fosslight_source-2.1.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|