fosslight-source 2.3.14__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.14/src/fosslight_source.egg-info → fosslight_source-2.3.15}/PKG-INFO +1 -1
  2. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/pyproject.toml +1 -1
  3. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source/_exclude.py +13 -1
  4. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source/_help.py +0 -1
  5. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source/_scan_item.py +3 -2
  6. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source/cli.py +11 -4
  7. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source/run_scanoss.py +2 -0
  8. {fosslight_source-2.3.14 → fosslight_source-2.3.15/src/fosslight_source.egg-info}/PKG-INFO +1 -1
  9. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/LICENSE +0 -0
  10. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/MANIFEST.in +0 -0
  11. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/README.md +0 -0
  12. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/setup.cfg +0 -0
  13. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source/__init__.py +0 -0
  14. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source/_kb_client.py +0 -0
  15. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source/_license_matched.py +0 -0
  16. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source/_merge.py +0 -0
  17. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source/_parsing_scancode_file_item.py +0 -0
  18. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source/_parsing_scanoss_file.py +0 -0
  19. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source/_scancode_ignore_binaries.py +0 -0
  20. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source/run_manifest_extractor.py +0 -0
  21. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source/run_scancode.py +0 -0
  22. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source/run_spdx_extractor.py +0 -0
  23. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source.egg-info/SOURCES.txt +0 -0
  24. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source.egg-info/dependency_links.txt +0 -0
  25. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source.egg-info/entry_points.txt +0 -0
  26. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source.egg-info/requires.txt +0 -0
  27. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/src/fosslight_source.egg-info/top_level.txt +0 -0
  28. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/tests/test_kb_ssl.py +0 -0
  29. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/tests/test_manifest_android_bp.py +0 -0
  30. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/tests/test_manifest_composer.py +0 -0
  31. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/tests/test_manifest_pyproject.py +0 -0
  32. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/tests/test_manifest_recommended_scenarios.py +0 -0
  33. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/tests/test_manifest_setup_cfg.py +0 -0
  34. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/tests/test_multi_value_order.py +0 -0
  35. {fosslight_source-2.3.14 → fosslight_source-2.3.15}/tests/test_parsing_unknown_spdx.py +0 -0
  36. {fosslight_source-2.3.14 → 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.14
3
+ Version: 2.3.15
4
4
  Summary: FOSSLight Source Scanner
5
5
  Author: LG Electronics
6
6
  License-Expression: Apache-2.0
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "fosslight_source"
10
- version = "2.3.14"
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
@@ -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.14
3
+ Version: 2.3.15
4
4
  Summary: FOSSLight Source Scanner
5
5
  Author: LG Electronics
6
6
  License-Expression: Apache-2.0