fosslight-source 2.3.15__tar.gz → 2.3.17__tar.gz
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-2.3.15/src/fosslight_source.egg-info → fosslight_source-2.3.17}/PKG-INFO +3 -2
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/pyproject.toml +3 -2
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/cli.py +30 -16
- {fosslight_source-2.3.15 → fosslight_source-2.3.17/src/fosslight_source.egg-info}/PKG-INFO +3 -2
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source.egg-info/SOURCES.txt +1 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source.egg-info/requires.txt +2 -1
- fosslight_source-2.3.17/tests/test_spdx_license_text.py +54 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/LICENSE +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/MANIFEST.in +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/README.md +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/setup.cfg +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/__init__.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/_exclude.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/_help.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/_kb_client.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/_license_matched.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/_merge.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/_parsing_scancode_file_item.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/_parsing_scanoss_file.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/_scan_item.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/_scancode_ignore_binaries.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/run_manifest_extractor.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/run_scancode.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/run_scanoss.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/run_spdx_extractor.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source.egg-info/dependency_links.txt +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source.egg-info/entry_points.txt +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source.egg-info/top_level.txt +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/tests/test_kb_ssl.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/tests/test_manifest_android_bp.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/tests/test_manifest_composer.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/tests/test_manifest_pyproject.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/tests/test_manifest_recommended_scenarios.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/tests/test_manifest_setup_cfg.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/tests/test_multi_value_order.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/tests/test_parsing_unknown_spdx.py +0 -0
- {fosslight_source-2.3.15 → fosslight_source-2.3.17}/tests/test_tox.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fosslight_source
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.17
|
|
4
4
|
Summary: FOSSLight Source Scanner
|
|
5
5
|
Author: LG Electronics
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -20,7 +20,7 @@ Requires-Dist: setuptools<=80.10.2
|
|
|
20
20
|
Requires-Dist: pyparsing
|
|
21
21
|
Requires-Dist: scanoss>=1.45.0
|
|
22
22
|
Requires-Dist: XlsxWriter
|
|
23
|
-
Requires-Dist: fosslight_util>=2.2.
|
|
23
|
+
Requires-Dist: fosslight_util>=2.2.18
|
|
24
24
|
Requires-Dist: PyYAML
|
|
25
25
|
Requires-Dist: wheel>=0.38.1
|
|
26
26
|
Requires-Dist: intbitset
|
|
@@ -33,6 +33,7 @@ Requires-Dist: psycopg2-binary>=2.9.10; python_version >= "3.13"
|
|
|
33
33
|
Requires-Dist: tomli; python_version < "3.11"
|
|
34
34
|
Requires-Dist: tqdm
|
|
35
35
|
Requires-Dist: truststore
|
|
36
|
+
Requires-Dist: pluggy<1.7.0
|
|
36
37
|
Dynamic: license-file
|
|
37
38
|
|
|
38
39
|
<!--
|
|
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
|
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "fosslight_source"
|
|
10
|
-
version = "2.3.
|
|
10
|
+
version = "2.3.17"
|
|
11
11
|
description = "FOSSLight Source Scanner"
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
license = "Apache-2.0"
|
|
@@ -29,7 +29,7 @@ dependencies = [
|
|
|
29
29
|
"pyparsing",
|
|
30
30
|
"scanoss>=1.45.0",
|
|
31
31
|
"XlsxWriter",
|
|
32
|
-
"fosslight_util>=2.2.
|
|
32
|
+
"fosslight_util>=2.2.18",
|
|
33
33
|
"PyYAML",
|
|
34
34
|
"wheel>=0.38.1",
|
|
35
35
|
"intbitset",
|
|
@@ -44,6 +44,7 @@ dependencies = [
|
|
|
44
44
|
"tomli; python_version < '3.11'",
|
|
45
45
|
"tqdm",
|
|
46
46
|
"truststore",
|
|
47
|
+
"pluggy<1.7.0",
|
|
47
48
|
]
|
|
48
49
|
|
|
49
50
|
[project.optional-dependencies]
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
import sys
|
|
7
7
|
import os
|
|
8
|
-
import platform
|
|
9
8
|
import time
|
|
10
9
|
import warnings
|
|
11
10
|
import logging
|
|
@@ -171,16 +170,11 @@ def create_report_file(
|
|
|
171
170
|
# If -o does not contains file name, set default name
|
|
172
171
|
while len(output_files) < len(output_extensions):
|
|
173
172
|
output_files.append(None)
|
|
174
|
-
to_remove = [] # elements of spdx format on windows that should be removed
|
|
175
173
|
for i, output_extension in enumerate(output_extensions):
|
|
176
174
|
if output_files[i] is None or output_files[i] == "":
|
|
177
175
|
if formats:
|
|
178
176
|
if formats[i].startswith('spdx'):
|
|
179
|
-
|
|
180
|
-
logger.warning(f'{formats[i]} is not supported on Windows.Please remove {formats[i]} from format.')
|
|
181
|
-
to_remove.append(i)
|
|
182
|
-
else:
|
|
183
|
-
output_files[i] = f"fosslight_spdx_src_{name_time}"
|
|
177
|
+
output_files[i] = f"fosslight_spdx_src_{name_time}"
|
|
184
178
|
elif formats[i].startswith('cyclonedx'):
|
|
185
179
|
output_files[i] = f'fosslight_cyclonedx_src_{name_time}'
|
|
186
180
|
else:
|
|
@@ -193,14 +187,6 @@ def create_report_file(
|
|
|
193
187
|
output_files[i] = f"fosslight_opossum_src_{name_time}"
|
|
194
188
|
else:
|
|
195
189
|
output_files[i] = f"fosslight_report_src_{name_time}"
|
|
196
|
-
for index in sorted(to_remove, reverse=True):
|
|
197
|
-
# remove elements of spdx format on windows
|
|
198
|
-
del output_files[index]
|
|
199
|
-
del output_extensions[index]
|
|
200
|
-
del formats[index]
|
|
201
|
-
if len(output_extensions) < 1:
|
|
202
|
-
sys.exit(0)
|
|
203
|
-
|
|
204
190
|
if not correct_filepath:
|
|
205
191
|
correct_filepath = path_to_scan
|
|
206
192
|
|
|
@@ -259,6 +245,31 @@ def create_report_file(
|
|
|
259
245
|
scan_item = correct_item
|
|
260
246
|
logger.info("Success to correct with yaml.")
|
|
261
247
|
|
|
248
|
+
if license_list and any(output_format.startswith("spdx") for output_format in formats):
|
|
249
|
+
matched_texts_by_file = {}
|
|
250
|
+
for matched_license in license_list.values():
|
|
251
|
+
if not matched_license.matched_text:
|
|
252
|
+
continue
|
|
253
|
+
for matched_path in matched_license.files:
|
|
254
|
+
path_key = os.path.normcase(os.path.normpath(matched_path.replace("\\", "/")))
|
|
255
|
+
matched_texts_by_file.setdefault(path_key, []).append(matched_license)
|
|
256
|
+
|
|
257
|
+
for file_item in scan_item.file_items.get(PKG_NAME, []):
|
|
258
|
+
path_key = os.path.normcase(os.path.normpath(file_item.source_name_or_path.replace("\\", "/")))
|
|
259
|
+
for oss_item in file_item.oss_items:
|
|
260
|
+
if oss_item.exclude:
|
|
261
|
+
continue
|
|
262
|
+
for license_name in oss_item.license:
|
|
263
|
+
for matched_license in matched_texts_by_file.get(path_key, []):
|
|
264
|
+
declares_license = re.search(
|
|
265
|
+
r"(?:SPDX[-\s]+License[-\s]+Identifier\s*:\s*|\blicense\s*=\s*['\"]\s*)"
|
|
266
|
+
+ re.escape(license_name) + r"(?=[,'\"\s]|$)",
|
|
267
|
+
matched_license.matched_text, re.IGNORECASE,
|
|
268
|
+
)
|
|
269
|
+
if matched_license.license.casefold() == license_name.casefold() or declares_license:
|
|
270
|
+
oss_item.license_texts.setdefault(license_name, matched_license.matched_text)
|
|
271
|
+
break
|
|
272
|
+
|
|
262
273
|
finish_time = current_timestamp_utc()
|
|
263
274
|
scan_item.set_cover_finish_time(finish_time)
|
|
264
275
|
|
|
@@ -652,9 +663,12 @@ def run_scanners(
|
|
|
652
663
|
if not selected_scanner:
|
|
653
664
|
selected_scanner = ALL_MODE
|
|
654
665
|
if selected_scanner in ['scancode', ALL_MODE]:
|
|
666
|
+
need_matched_license = print_matched_text or any(
|
|
667
|
+
output_format.startswith("spdx") for output_format in formats
|
|
668
|
+
)
|
|
655
669
|
success, result_log[RESULT_KEY], scancode_result, license_list = run_scan(
|
|
656
670
|
path_to_scan, output_file_name, write_json_file, num_cores, True,
|
|
657
|
-
|
|
671
|
+
need_matched_license, formats, called_by_cli, time_out, correct_mode,
|
|
658
672
|
correct_filepath, path_to_exclude,
|
|
659
673
|
hide_progress=hide_progress,
|
|
660
674
|
ui_mode=ui_mode,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fosslight_source
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.17
|
|
4
4
|
Summary: FOSSLight Source Scanner
|
|
5
5
|
Author: LG Electronics
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -20,7 +20,7 @@ Requires-Dist: setuptools<=80.10.2
|
|
|
20
20
|
Requires-Dist: pyparsing
|
|
21
21
|
Requires-Dist: scanoss>=1.45.0
|
|
22
22
|
Requires-Dist: XlsxWriter
|
|
23
|
-
Requires-Dist: fosslight_util>=2.2.
|
|
23
|
+
Requires-Dist: fosslight_util>=2.2.18
|
|
24
24
|
Requires-Dist: PyYAML
|
|
25
25
|
Requires-Dist: wheel>=0.38.1
|
|
26
26
|
Requires-Dist: intbitset
|
|
@@ -33,6 +33,7 @@ Requires-Dist: psycopg2-binary>=2.9.10; python_version >= "3.13"
|
|
|
33
33
|
Requires-Dist: tomli; python_version < "3.11"
|
|
34
34
|
Requires-Dist: tqdm
|
|
35
35
|
Requires-Dist: truststore
|
|
36
|
+
Requires-Dist: pluggy<1.7.0
|
|
36
37
|
Dynamic: license-file
|
|
37
38
|
|
|
38
39
|
<!--
|
{fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source.egg-info/requires.txt
RENAMED
|
@@ -2,7 +2,7 @@ setuptools<=80.10.2
|
|
|
2
2
|
pyparsing
|
|
3
3
|
scanoss>=1.45.0
|
|
4
4
|
XlsxWriter
|
|
5
|
-
fosslight_util>=2.2.
|
|
5
|
+
fosslight_util>=2.2.18
|
|
6
6
|
PyYAML
|
|
7
7
|
wheel>=0.38.1
|
|
8
8
|
intbitset
|
|
@@ -12,6 +12,7 @@ fingerprints==1.2.3
|
|
|
12
12
|
normality==2.6.1
|
|
13
13
|
tqdm
|
|
14
14
|
truststore
|
|
15
|
+
pluggy<1.7.0
|
|
15
16
|
|
|
16
17
|
[:platform_system == "Darwin" and platform_machine == "x86_64"]
|
|
17
18
|
cryptography<49
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# Copyright (c) 2026 LG Electronics Inc.
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
7
|
+
from spdx_tools.spdx.parser.parse_anything import parse_file
|
|
8
|
+
from spdx_tools.spdx.validation.document_validator import validate_full_spdx_document
|
|
9
|
+
|
|
10
|
+
from fosslight_source import cli as source_cli
|
|
11
|
+
from fosslight_source._license_matched import MatchedLicense
|
|
12
|
+
from fosslight_source._scan_item import SourceItem
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@pytest.mark.parametrize("matched_text, expected_text", [
|
|
16
|
+
(' license="BSD",', ' license="BSD",'),
|
|
17
|
+
("", "BSD"),
|
|
18
|
+
])
|
|
19
|
+
def test_spdx_uses_scancode_matched_text_without_reference_sheet(
|
|
20
|
+
tmp_path, monkeypatch, matched_text, expected_text
|
|
21
|
+
):
|
|
22
|
+
project = tmp_path / "project"
|
|
23
|
+
project.mkdir()
|
|
24
|
+
(project / "setup.py").write_text('license="BSD"\n', encoding="utf-8")
|
|
25
|
+
output = tmp_path / "reports"
|
|
26
|
+
source_item = SourceItem("setup.py")
|
|
27
|
+
source_item.checksum = "a" * 40
|
|
28
|
+
source_item.licenses = ["BSD-3-Clause"]
|
|
29
|
+
matched_license = MatchedLicense("BSD-3-Clause", "", matched_text, "setup.py")
|
|
30
|
+
license_list = {matched_license.license + matched_license.matched_text: matched_license}
|
|
31
|
+
received_need_matched_text = []
|
|
32
|
+
|
|
33
|
+
def run_scancode(*args, **kwargs):
|
|
34
|
+
received_need_matched_text.append(args[5])
|
|
35
|
+
return True, "True", [source_item], license_list
|
|
36
|
+
|
|
37
|
+
monkeypatch.chdir(tmp_path)
|
|
38
|
+
monkeypatch.setattr(source_cli, "run_scan", run_scancode)
|
|
39
|
+
|
|
40
|
+
success, message, scan_item, _licenses, _scanoss_result = source_cli.run_scanners(
|
|
41
|
+
str(project), str(output), selected_scanner="scancode", formats=["spdx-json"],
|
|
42
|
+
print_matched_text=False, correct_mode=False, all_exclude_mode=([], [], set(), 1),
|
|
43
|
+
hide_progress=True,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
assert success, message
|
|
47
|
+
assert received_need_matched_text == [True]
|
|
48
|
+
assert "scancode_reference" not in scan_item.external_sheets
|
|
49
|
+
assert scan_item.file_items[source_cli.PKG_NAME][0].oss_items[0].license == ["BSD"]
|
|
50
|
+
document = parse_file(str(next(output.glob("*.json"))))
|
|
51
|
+
assert validate_full_spdx_document(document) == []
|
|
52
|
+
assert document.extracted_licensing_info[0].license_name == "BSD"
|
|
53
|
+
assert document.extracted_licensing_info[0].extracted_text == expected_text
|
|
54
|
+
assert {str(value) for value in document.files[0].license_info_in_file} == {"LicenseRef-BSD"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/_license_matched.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/_parsing_scanoss_file.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/run_manifest_extractor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source/run_spdx_extractor.py
RENAMED
|
File without changes
|
|
File without changes
|
{fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{fosslight_source-2.3.15 → fosslight_source-2.3.17}/src/fosslight_source.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fosslight_source-2.3.15 → fosslight_source-2.3.17}/tests/test_manifest_recommended_scenarios.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|