fosslight-source 2.3.13__tar.gz → 2.3.15__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.
Files changed (36) hide show
  1. {fosslight_source-2.3.13/src/fosslight_source.egg-info → fosslight_source-2.3.15}/PKG-INFO +2 -2
  2. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/README.md +1 -1
  3. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/pyproject.toml +1 -1
  4. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source/_exclude.py +13 -1
  5. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source/_help.py +0 -1
  6. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source/_scan_item.py +4 -3
  7. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source/cli.py +11 -4
  8. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source/run_scanoss.py +2 -0
  9. {fosslight_source-2.3.13 → fosslight_source-2.3.15/src/fosslight_source.egg-info}/PKG-INFO +2 -2
  10. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/tests/test_parsing_unknown_spdx.py +7 -7
  11. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/LICENSE +0 -0
  12. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/MANIFEST.in +0 -0
  13. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/setup.cfg +0 -0
  14. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source/__init__.py +0 -0
  15. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source/_kb_client.py +0 -0
  16. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source/_license_matched.py +0 -0
  17. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source/_merge.py +0 -0
  18. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source/_parsing_scancode_file_item.py +0 -0
  19. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source/_parsing_scanoss_file.py +0 -0
  20. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source/_scancode_ignore_binaries.py +0 -0
  21. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source/run_manifest_extractor.py +0 -0
  22. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source/run_scancode.py +0 -0
  23. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source/run_spdx_extractor.py +0 -0
  24. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source.egg-info/SOURCES.txt +0 -0
  25. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source.egg-info/dependency_links.txt +0 -0
  26. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source.egg-info/entry_points.txt +0 -0
  27. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source.egg-info/requires.txt +0 -0
  28. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/src/fosslight_source.egg-info/top_level.txt +0 -0
  29. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/tests/test_kb_ssl.py +0 -0
  30. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/tests/test_manifest_android_bp.py +0 -0
  31. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/tests/test_manifest_composer.py +0 -0
  32. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/tests/test_manifest_pyproject.py +0 -0
  33. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/tests/test_manifest_recommended_scenarios.py +0 -0
  34. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/tests/test_manifest_setup_cfg.py +0 -0
  35. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/tests/test_multi_value_order.py +0 -0
  36. {fosslight_source-2.3.13 → fosslight_source-2.3.15}/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.13
3
+ Version: 2.3.15
4
4
  Summary: FOSSLight Source Scanner
5
5
  Author: LG Electronics
6
6
  License-Expression: Apache-2.0
@@ -55,7 +55,7 @@ Detect the license for the source code.
55
55
  Use Source Code Scanner and process the scanner results.
56
56
  ```
57
57
 
58
- **FOSSLight Source Scanner** uses source code scanners, [ScanCode][sc] and [SCANOSS][scanoss]. [ScanCode][sc] detects copyright and license phrases contained in the file and [SCANOSS][scanoss] searches OSS Name, OSS Version, download location, copyright and license information from [OSSKB][osskb]. Some files (ex- build script), binary files, directory and files in specific directories (ex-test) are excluded from the result. And removes words such as "-only" and "-old-style" from the license name to be printed. The output result is generated in spreadsheet format.
58
+ **FOSSLight Source Scanner** uses source code scanners, [ScanCode][sc] and [SCANOSS][scanoss]. [ScanCode][sc] detects copyright and license phrases contained in the file and [SCANOSS][scanoss] searches OSS Name, OSS Version, download location, copyright and license information from [OSSKB][osskb]. Some files (ex- build script), binary files, directory and files in specific directories (ex-test) are excluded from the result. The output result is generated in spreadsheet format.
59
59
 
60
60
 
61
61
  [sc]: https://github.com/nexB/scancode-toolkit
@@ -18,7 +18,7 @@ Detect the license for the source code.
18
18
  Use Source Code Scanner and process the scanner results.
19
19
  ```
20
20
 
21
- **FOSSLight Source Scanner** uses source code scanners, [ScanCode][sc] and [SCANOSS][scanoss]. [ScanCode][sc] detects copyright and license phrases contained in the file and [SCANOSS][scanoss] searches OSS Name, OSS Version, download location, copyright and license information from [OSSKB][osskb]. Some files (ex- build script), binary files, directory and files in specific directories (ex-test) are excluded from the result. And removes words such as "-only" and "-old-style" from the license name to be printed. The output result is generated in spreadsheet format.
21
+ **FOSSLight Source Scanner** uses source code scanners, [ScanCode][sc] and [SCANOSS][scanoss]. [ScanCode][sc] detects copyright and license phrases contained in the file and [SCANOSS][scanoss] searches OSS Name, OSS Version, download location, copyright and license information from [OSSKB][osskb]. Some files (ex- build script), binary files, directory and files in specific directories (ex-test) are excluded from the result. The output result is generated in spreadsheet format.
22
22
 
23
23
 
24
24
  [sc]: https://github.com/nexB/scancode-toolkit
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "fosslight_source"
10
- version = "2.3.13"
10
+ version = "2.3.15"
11
11
  description = "FOSSLight Source Scanner"
12
12
  readme = "README.md"
13
13
  license = "Apache-2.0"
@@ -1,10 +1,14 @@
1
1
  # Copyright (c) 2026 LG Electronics Inc.
2
2
  # SPDX-License-Identifier: Apache-2.0
3
3
 
4
- """Source-scanner filename excludes (not applied to dependency discovery)."""
4
+ """Source-scanner exclusion helpers (not applied to dependency discovery)."""
5
+
6
+ import os
5
7
 
6
8
  from fosslight_util.exclude import is_excluded_filename
7
9
 
10
+ DEFAULT_SKIP_SMALL_FILE_SIZE = 150
11
+
8
12
  # Build/package config noise for license scans.
9
13
  EXCLUDE_FILENAME_SOURCE = frozenset({
10
14
  "changelog", "config.guess", "config.sub", "changes", "ltmain.sh",
@@ -19,3 +23,11 @@ EXCLUDE_FILENAME_SOURCE = frozenset({
19
23
 
20
24
  def is_excluded_source_filename(file_path: str) -> bool:
21
25
  return is_excluded_filename(file_path, EXCLUDE_FILENAME_SOURCE)
26
+
27
+
28
+ def is_small_file(file_path: str) -> bool:
29
+ """Return whether a file is at or below the KB/SCANOSS size threshold."""
30
+ try:
31
+ return os.path.getsize(file_path) <= DEFAULT_SKIP_SMALL_FILE_SIZE
32
+ except OSError:
33
+ return False
@@ -47,7 +47,6 @@ _HELP_MESSAGE_SOURCE_SCANNER = f"""
47
47
  --kb_token <token> KB bearer token (priority: parameter > KB_TOKEN env)
48
48
  HTTPS uses the OS certificate store. Set KB_SSL_VERIFY=false
49
49
  only if certificate verification must be skipped.
50
-
51
50
  💡 Examples
52
51
  ────────────────────────────────────────────────────────────────────
53
52
  # Scan current directory
@@ -12,7 +12,7 @@ import fosslight_util.constant as constant
12
12
  from fosslight_util.oss_item import FileItem, OssItem, get_checksum_sha1
13
13
 
14
14
  logger = logging.getLogger(constant.LOGGER_NAME)
15
- replace_word = ["-only", "-old-style", "-or-later", "licenseref-scancode-", "licenseref-"]
15
+ replace_word = ["licenseref-scancode-", "licenseref-"]
16
16
  _notice_filename = ['licen[cs]e[s]?', 'notice[s]?', 'legal', 'copyright[s]?', 'copying*', 'patent[s]?', 'unlicen[cs]e', 'eula',
17
17
  '[a,l]?gpl[-]?[1-3]?[.,-,_]?[0-1]?', 'mit', 'bsd[-]?[0-4]?', 'bsd[-]?[0-4][-]?clause[s]?',
18
18
  'apache[-,_]?[1-2]?[.,-,_]?[0-2]?']
@@ -63,7 +63,7 @@ class SourceItem(FileItem):
63
63
  self.checksum = get_checksum_sha1(value)
64
64
  self.kb_origin_url = "" # URL from OSS KB
65
65
  self.kb_evidence = "" # Evidence from KB API (exact_match or code snippet)
66
- self._cached_kb_md5 = "" # MD5 precomputed for KB lookup (set by _collect_kb_file_hashes)
66
+ self._cached_kb_md5: str | None = None # None: not checked; empty: checked but no KB hash
67
67
 
68
68
  def __del__(self) -> None:
69
69
  pass
@@ -192,8 +192,9 @@ class SourceItem(FileItem):
192
192
  item = OssItem(self.oss_name, self.oss_version, self.licenses)
193
193
  if kb_origin_urls and not self.is_license_text:
194
194
  md5_hash = self._cached_kb_md5
195
- if not md5_hash:
195
+ if md5_hash is None:
196
196
  md5_hash, _wfp = self._get_hash(path_to_scan)
197
+ self._cached_kb_md5 = md5_hash
197
198
  if md5_hash:
198
199
  origin_url = kb_origin_urls.get(md5_hash, "")
199
200
  if origin_url:
@@ -22,7 +22,7 @@ from fosslight_util.correct import correct_with_yaml
22
22
  from fosslight_util.parsing_yaml import SUPPORT_OSS_INFO_FILES
23
23
  from .run_scancode import run_scan
24
24
  from fosslight_util.exclude import get_excluded_paths
25
- from ._exclude import EXCLUDE_FILENAME_SOURCE, is_excluded_source_filename
25
+ from ._exclude import EXCLUDE_FILENAME_SOURCE, is_excluded_source_filename, is_small_file
26
26
  from .run_scanoss import run_scanoss_py
27
27
  from .run_scanoss import get_scanoss_extra_info
28
28
  import yaml
@@ -93,7 +93,6 @@ def main() -> None:
93
93
  parser.add_argument('--ui', action='store_true', required=False)
94
94
 
95
95
  args = parser.parse_args()
96
-
97
96
  if args.help:
98
97
  print_help_msg_source_scanner()
99
98
  if args.version:
@@ -362,9 +361,15 @@ def _collect_kb_file_hashes(
362
361
  extra_candidates: list[tuple[SourceItem, str]] = []
363
362
 
364
363
  for item in scancode_result:
365
- if item.is_license_text or is_notice_file(item.source_name_or_path):
364
+ if item.is_license_text or item.download_location or is_notice_file(item.source_name_or_path):
365
+ item._cached_kb_md5 = ""
366
366
  continue
367
- if item.download_location:
367
+ item_path = item.source_name_or_path
368
+ if not os.path.isabs(item_path):
369
+ item_path = os.path.join(path_to_scan, item_path)
370
+ if is_small_file(item_path):
371
+ # An empty cached hash means this item is checked and not KB-eligible.
372
+ item._cached_kb_md5 = ""
368
373
  continue
369
374
  md5_hash, _wfp = item._get_hash(path_to_scan)
370
375
  if md5_hash:
@@ -384,6 +389,8 @@ def _collect_kb_file_hashes(
384
389
  if (rel_path in scancode_paths or rel_path in excluded_files
385
390
  or is_excluded_source_filename(rel_path) or is_notice_file(file_path)):
386
391
  continue
392
+ if is_small_file(file_path):
393
+ continue
387
394
  extra_item = SourceItem(rel_path)
388
395
  md5_hash, _wfp = extra_item._get_hash(path_to_scan)
389
396
  if md5_hash:
@@ -10,6 +10,7 @@ import logging
10
10
  import json
11
11
  from typing import Tuple
12
12
  import fosslight_util.constant as constant
13
+ from ._exclude import DEFAULT_SKIP_SMALL_FILE_SIZE
13
14
  from ._parsing_scanoss_file import parsing_scan_result # scanoss
14
15
  from ._parsing_scanoss_file import parsing_extra_info # scanoss
15
16
  from scanoss.scanner import Scanner, ScanType
@@ -66,6 +67,7 @@ def run_scanoss_py(path_to_scan: str, output_path: str = "", format: list = [],
66
67
  scanner = Scanner(
67
68
  ignore_cert_errors=True,
68
69
  skip_folders=list(path_to_exclude) if path_to_exclude else [],
70
+ skip_size=DEFAULT_SKIP_SMALL_FILE_SIZE + 1,
69
71
  scan_output=output_json_file,
70
72
  scan_options=ScanType.SCAN_SNIPPETS.value,
71
73
  nb_threads=num_threads if num_threads > 0 else 10,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fosslight_source
3
- Version: 2.3.13
3
+ Version: 2.3.15
4
4
  Summary: FOSSLight Source Scanner
5
5
  Author: LG Electronics
6
6
  License-Expression: Apache-2.0
@@ -55,7 +55,7 @@ Detect the license for the source code.
55
55
  Use Source Code Scanner and process the scanner results.
56
56
  ```
57
57
 
58
- **FOSSLight Source Scanner** uses source code scanners, [ScanCode][sc] and [SCANOSS][scanoss]. [ScanCode][sc] detects copyright and license phrases contained in the file and [SCANOSS][scanoss] searches OSS Name, OSS Version, download location, copyright and license information from [OSSKB][osskb]. Some files (ex- build script), binary files, directory and files in specific directories (ex-test) are excluded from the result. And removes words such as "-only" and "-old-style" from the license name to be printed. The output result is generated in spreadsheet format.
58
+ **FOSSLight Source Scanner** uses source code scanners, [ScanCode][sc] and [SCANOSS][scanoss]. [ScanCode][sc] detects copyright and license phrases contained in the file and [SCANOSS][scanoss] searches OSS Name, OSS Version, download location, copyright and license information from [OSSKB][osskb]. Some files (ex- build script), binary files, directory and files in specific directories (ex-test) are excluded from the result. The output result is generated in spreadsheet format.
59
59
 
60
60
 
61
61
  [sc]: https://github.com/nexB/scancode-toolkit
@@ -107,8 +107,8 @@ def test_unknown_spdx_in_compound_expression_splits_and_or():
107
107
  success, results, _messages, _ = parsing_scancode(scancode_file_list)
108
108
 
109
109
  assert success is True
110
- assert results[0].licenses == ["GPL-2.0", "MIT-like"]
111
- assert results[0].comment == "GPL-2.0 OR MIT-like"
110
+ assert results[0].licenses == ["GPL-2.0-only", "MIT-like"]
111
+ assert results[0].comment == "GPL-2.0-only OR MIT-like"
112
112
 
113
113
 
114
114
  def test_unknown_spdx_comment_preserves_and_or_from_detected_expression():
@@ -171,7 +171,7 @@ def test_unknown_license_reference_suppressed_when_same_matched_text_has_other_l
171
171
  success, results, _messages, _ = parsing_scancode(scancode_file_list)
172
172
 
173
173
  assert success is True
174
- assert results[0].licenses == ["GPL-2.0"]
174
+ assert results[0].licenses == ["GPL-2.0-only"]
175
175
 
176
176
 
177
177
  @pytest.mark.parametrize(
@@ -381,7 +381,7 @@ def test_build_comment_from_detected_expression_helper():
381
381
  matches,
382
382
  _should_suppress_unknown_license_reference(matches, has_other_license),
383
383
  )
384
- assert comment == "NEW OR DApache-2.0 AND GPL-2.0"
384
+ assert comment == "NEW OR DApache-2.0 AND GPL-2.0-only"
385
385
 
386
386
 
387
387
  def test_comment_without_parens_uses_operator_before_kept_token():
@@ -554,7 +554,7 @@ def test_ignore_unknown_spdx_when_file_has_spdx_declaration():
554
554
  success, results, _messages, _ = parsing_scancode(scancode_file_list)
555
555
 
556
556
  assert success is True
557
- assert results[0].licenses == ["GPL-2.0"]
557
+ assert results[0].licenses == ["GPL-2.0-only"]
558
558
  assert all("unknown" not in lic.lower() for lic in results[0].licenses)
559
559
  assert all("tag" not in lic.lower() for lic in results[0].licenses)
560
560
 
@@ -604,7 +604,7 @@ def test_spdx_priority_drops_body_rule_matches():
604
604
  success, results, _messages, _ = parsing_scancode(scancode_file_list)
605
605
 
606
606
  assert success is True
607
- assert results[0].licenses == ["GPL-2.0"]
607
+ assert results[0].licenses == ["GPL-2.0-only"]
608
608
  # Body singles covered by OR expression are dropped; Detected keeps the OR form.
609
609
  assert results[0].comment == "Detected: gpl-2.0 OR bsd-simplified"
610
610
 
@@ -852,7 +852,7 @@ def test_spdx_priority_detected_comment_uses_spdx_ids():
852
852
  success, results, _messages, _ = parsing_scancode(scancode_file_list)
853
853
 
854
854
  assert success is True
855
- assert results[0].licenses == ["GPL-2.0"]
855
+ assert results[0].licenses == ["GPL-2.0-only"]
856
856
  assert results[0].comment == (
857
857
  "Detected: GPL-2.0-only OR BSD-2-Clause, unknown-spdx"
858
858
  )