fosslight-source 2.2.13__tar.gz → 2.2.14__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 (24) hide show
  1. {fosslight_source-2.2.13/src/fosslight_source.egg-info → fosslight_source-2.2.14}/PKG-INFO +3 -2
  2. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/pyproject.toml +3 -2
  3. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/src/fosslight_source/_help.py +1 -0
  4. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/src/fosslight_source/cli.py +22 -20
  5. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/src/fosslight_source/run_scancode.py +18 -4
  6. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/src/fosslight_source/run_scanoss.py +3 -2
  7. {fosslight_source-2.2.13 → fosslight_source-2.2.14/src/fosslight_source.egg-info}/PKG-INFO +3 -2
  8. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/src/fosslight_source.egg-info/requires.txt +2 -1
  9. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/LICENSE +0 -0
  10. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/MANIFEST.in +0 -0
  11. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/README.md +0 -0
  12. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/setup.cfg +0 -0
  13. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/src/fosslight_source/__init__.py +0 -0
  14. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/src/fosslight_source/_license_matched.py +0 -0
  15. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/src/fosslight_source/_parsing_scancode_file_item.py +0 -0
  16. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/src/fosslight_source/_parsing_scanoss_file.py +0 -0
  17. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/src/fosslight_source/_scan_item.py +0 -0
  18. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/src/fosslight_source/run_manifest_extractor.py +0 -0
  19. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/src/fosslight_source/run_spdx_extractor.py +0 -0
  20. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/src/fosslight_source.egg-info/SOURCES.txt +0 -0
  21. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/src/fosslight_source.egg-info/dependency_links.txt +0 -0
  22. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/src/fosslight_source.egg-info/entry_points.txt +0 -0
  23. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/src/fosslight_source.egg-info/top_level.txt +0 -0
  24. {fosslight_source-2.2.13 → fosslight_source-2.2.14}/tests/test_tox.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fosslight_source
3
- Version: 2.2.13
3
+ Version: 2.2.14
4
4
  Summary: FOSSLight Source Scanner
5
5
  Author: LG Electronics
6
6
  License-Expression: Apache-2.0
@@ -24,11 +24,12 @@ Requires-Dist: fosslight_util>=2.1.37
24
24
  Requires-Dist: PyYAML
25
25
  Requires-Dist: wheel>=0.38.1
26
26
  Requires-Dist: intbitset
27
- Requires-Dist: fosslight_binary>=5.0.0
27
+ Requires-Dist: fosslight_binary>=5.1.22
28
28
  Requires-Dist: scancode-toolkit>=32.0.2
29
29
  Requires-Dist: fingerprints==1.2.3
30
30
  Requires-Dist: normality==2.6.1
31
31
  Requires-Dist: psycopg2-binary>=2.9.10; python_version >= "3.13"
32
+ Requires-Dist: tqdm
32
33
  Dynamic: license-file
33
34
 
34
35
  <!--
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "fosslight_source"
10
- version = "2.2.13"
10
+ version = "2.2.14"
11
11
  description = "FOSSLight Source Scanner"
12
12
  readme = "README.md"
13
13
  license = "Apache-2.0"
@@ -33,12 +33,13 @@ dependencies = [
33
33
  "PyYAML",
34
34
  "wheel>=0.38.1",
35
35
  "intbitset",
36
- "fosslight_binary>=5.0.0",
36
+ "fosslight_binary>=5.1.22",
37
37
  "scancode-toolkit>=32.0.2",
38
38
  "fingerprints==1.2.3",
39
39
  "normality==2.6.1",
40
40
  # Python 3.13+ needs psycopg2-binary 2.9.10+ (has wheels; 2.9.9 builds fail with _PyInterpreterState_Get)
41
41
  "psycopg2-binary>=2.9.10; python_version >= '3.13'",
42
+ "tqdm",
42
43
  ]
43
44
 
44
45
  [project.optional-dependencies]
@@ -41,6 +41,7 @@ _HELP_MESSAGE_SOURCE_SCANNER = f"""
41
41
  -j Generate raw scanner results in JSON format
42
42
  --no_correction Skip OSS information correction with sbom-info.yaml
43
43
  --correct_fpath <path> Path to custom sbom-info.yaml file
44
+ --hide_progress Hide the progress bar during scanning
44
45
 
45
46
  💡 Examples
46
47
  ────────────────────────────────────────────────────────────────────
@@ -14,7 +14,6 @@ import urllib.error
14
14
  from datetime import datetime
15
15
  import fosslight_util.constant as constant
16
16
  from fosslight_util.set_log import init_log
17
- from fosslight_util.timer_thread import TimerThread
18
17
  from ._help import print_version, print_help_msg_source_scanner
19
18
  from ._license_matched import get_license_list_to_print
20
19
  from fosslight_util.output_format import check_output_formats_v2, write_output_file
@@ -81,6 +80,7 @@ def main() -> None:
81
80
  parser.add_argument('-e', '--exclude', nargs='*', required=False, default=[])
82
81
  parser.add_argument('--no_correction', action='store_true', required=False)
83
82
  parser.add_argument('--correct_fpath', nargs=1, type=str, required=False)
83
+ parser.add_argument('--hide_progress', action='store_true', required=False)
84
84
 
85
85
  args = parser.parse_args()
86
86
 
@@ -108,19 +108,16 @@ def main() -> None:
108
108
  correct_filepath = path_to_scan
109
109
  if args.correct_fpath:
110
110
  correct_filepath = ''.join(args.correct_fpath)
111
+ hide_progress = args.hide_progress
111
112
 
112
113
  time_out = args.timeout
113
114
  core = args.cores
114
115
 
115
- timer = TimerThread()
116
- timer.setDaemon(True)
117
- timer.start()
118
-
119
116
  if os.path.isdir(path_to_scan):
120
117
  result = []
121
118
  result = run_scanners(path_to_scan, output_file_name, write_json_file, core, True,
122
119
  print_matched_text, formats, time_out, correct_mode, correct_filepath,
123
- selected_scanner, path_to_exclude)
120
+ selected_scanner, path_to_exclude, hide_progress=hide_progress)
124
121
 
125
122
  _result_log["Scan Result"] = result[1]
126
123
 
@@ -318,7 +315,7 @@ def get_kb_reference_to_print(merged_result: list) -> list:
318
315
  def merge_results(
319
316
  scancode_result: list = [], scanoss_result: list = [], spdx_downloads: dict = {},
320
317
  path_to_scan: str = "", run_kb: bool = False, manifest_licenses: dict = {},
321
- excluded_files: set = None
318
+ excluded_files: set = None, hide_progress: bool = False
322
319
  ) -> list:
323
320
 
324
321
  """
@@ -367,19 +364,24 @@ def merge_results(
367
364
  # Add OSSItem for files in path_to_scan that are not in scancode_result
368
365
  # when KB returns an origin URL for their MD5 hash (skip excluded_files)
369
366
  if run_kb:
367
+ import tqdm
370
368
  abs_path_to_scan = os.path.abspath(path_to_scan)
371
369
  scancode_paths = {item.source_name_or_path for item in scancode_result}
370
+
371
+ files_to_scan = []
372
372
  for root, _dirs, files in os.walk(path_to_scan):
373
373
  for file in files:
374
- file_path = os.path.join(root, file)
375
- rel_path = os.path.relpath(file_path, abs_path_to_scan).replace("\\", "/")
376
- if rel_path in scancode_paths or rel_path in excluded_files:
377
- continue
378
- extra_item = SourceItem(rel_path)
379
- extra_item.set_oss_item(path_to_scan, run_kb)
380
- if extra_item.download_location:
381
- scancode_result.append(extra_item)
382
- scancode_paths.add(rel_path)
374
+ files_to_scan.append(os.path.join(root, file))
375
+
376
+ for file_path in tqdm.tqdm(files_to_scan, desc="KB Scanning", disable=hide_progress):
377
+ rel_path = os.path.relpath(file_path, abs_path_to_scan).replace("\\", "/")
378
+ if rel_path in scancode_paths or rel_path in excluded_files:
379
+ continue
380
+ extra_item = SourceItem(rel_path)
381
+ extra_item.set_oss_item(path_to_scan, run_kb)
382
+ if extra_item.download_location:
383
+ scancode_result.append(extra_item)
384
+ scancode_paths.add(rel_path)
383
385
 
384
386
  return scancode_result
385
387
 
@@ -391,7 +393,7 @@ def run_scanners(
391
393
  formats: list = [], time_out: int = 120,
392
394
  correct_mode: bool = True, correct_filepath: str = "",
393
395
  selected_scanner: str = ALL_MODE, path_to_exclude: list = [],
394
- all_exclude_mode: tuple = ()
396
+ all_exclude_mode: tuple = (), hide_progress: bool = False
395
397
  ) -> Tuple[bool, str, 'ScannerItem', list, list]:
396
398
  """
397
399
  Run Scancode and scanoss.py for the given path.
@@ -456,12 +458,12 @@ def run_scanners(
456
458
  print_matched_text, formats, called_by_cli,
457
459
  time_out, correct_mode, correct_filepath,
458
460
  excluded_path_with_default_exclusion,
459
- excluded_files)
461
+ excluded_files, hide_progress)
460
462
  excluded_files = set(excluded_files) if excluded_files else set()
461
463
  if selected_scanner in ['scanoss', ALL_MODE]:
462
464
  scanoss_result, api_limit_exceed = run_scanoss_py(path_to_scan, output_path, formats, True, num_cores,
463
465
  excluded_path_with_default_exclusion, excluded_files,
464
- write_json_file)
466
+ write_json_file, hide_progress)
465
467
 
466
468
  run_kb_msg = ""
467
469
  if selected_scanner in SCANNER_TYPE:
@@ -475,7 +477,7 @@ def run_scanners(
475
477
 
476
478
  spdx_downloads, manifest_licenses = metadata_collector(path_to_scan, excluded_files)
477
479
  merged_result = merge_results(scancode_result, scanoss_result, spdx_downloads,
478
- path_to_scan, run_kb, manifest_licenses, excluded_files)
480
+ path_to_scan, run_kb, manifest_licenses, excluded_files, hide_progress)
479
481
  scan_item = create_report_file(start_time, merged_result, license_list, scanoss_result, selected_scanner,
480
482
  print_matched_text, output_path, output_files, output_extensions, correct_mode,
481
483
  correct_filepath, path_to_scan, excluded_path_without_dot, formats,
@@ -63,7 +63,7 @@ def run_scan(
63
63
  formats: list = [], called_by_cli: bool = False,
64
64
  time_out: int = 120, correct_mode: bool = True,
65
65
  correct_filepath: str = "", path_to_exclude: list = [],
66
- excluded_files: list = []
66
+ excluded_files: list = [], hide_progress: bool = False
67
67
  ) -> Tuple[bool, str, list, list]:
68
68
  if not called_by_cli:
69
69
  global logger
@@ -113,8 +113,8 @@ def run_scan(
113
113
  pretty_params["path_to_exclude"] = path_to_exclude
114
114
  pretty_params["output_file"] = output_file_name
115
115
  total_files_to_excluded = []
116
+ abs_path_to_scan = os.path.abspath(path_to_scan)
116
117
  if path_to_exclude:
117
- abs_path_to_scan = os.path.abspath(path_to_scan)
118
118
  for path in path_to_exclude:
119
119
  if os.path.isabs(path):
120
120
  exclude_path = os.path.relpath(path, abs_path_to_scan)
@@ -156,6 +156,19 @@ def run_scan(
156
156
  else:
157
157
  total_files_to_excluded.append(exclude_path_normalized)
158
158
 
159
+ for root, _, files in os.walk(path_to_scan):
160
+ for name in files:
161
+ full_path = os.path.join(root, name)
162
+ try:
163
+ if not check_binary(full_path, True):
164
+ continue
165
+ except Exception:
166
+ continue
167
+ rel_path = os.path.relpath(full_path, abs_path_to_scan)
168
+ rel_norm = os.path.normpath(rel_path).replace("\\", "/")
169
+ excluded_files.append(rel_norm)
170
+ logger.debug(f"Excluded binary from scancode: {rel_norm}")
171
+
159
172
  if excluded_files:
160
173
  total_files_to_excluded.extend(f"**/{file_path}" for file_path in excluded_files)
161
174
 
@@ -176,7 +189,8 @@ def run_scan(
176
189
  "url": True,
177
190
  "timeout": time_out,
178
191
  "include": (),
179
- "ignore": ignore_tuple
192
+ "ignore": ignore_tuple,
193
+ "quiet": hide_progress
180
194
  }
181
195
 
182
196
  _apply_scancode_unset_workaround(kwargs)
@@ -206,7 +220,7 @@ def run_scan(
206
220
  for scan_item in result_list:
207
221
  if os.path.isdir(scan_item.source_name_or_path):
208
222
  continue
209
- if check_binary(os.path.join(path_to_scan, scan_item.source_name_or_path)):
223
+ if check_binary(os.path.join(path_to_scan, scan_item.source_name_or_path), True):
210
224
  scan_item.exclude = True
211
225
  except Exception as ex:
212
226
  success = False
@@ -31,7 +31,7 @@ def get_scanoss_extra_info(scanned_result: dict) -> list:
31
31
  def run_scanoss_py(path_to_scan: str, output_path: str = "", format: list = [],
32
32
  called_by_cli: bool = False, num_threads: int = -1,
33
33
  path_to_exclude: list = [], excluded_files: set = None,
34
- write_json_file: bool = False) -> Tuple[list, bool]:
34
+ write_json_file: bool = False, hide_progress: bool = False) -> Tuple[list, bool]:
35
35
  """
36
36
  Run scanoss.py for the given path.
37
37
 
@@ -58,6 +58,7 @@ def run_scanoss_py(path_to_scan: str, output_path: str = "", format: list = [],
58
58
  os.remove(output_json_file)
59
59
 
60
60
  try:
61
+ logger.debug(f"|---Running SCANOSS on {path_to_scan}")
61
62
  scanoss_settings = ScanossSettings()
62
63
  scanner = Scanner(
63
64
  ignore_cert_errors=True,
@@ -67,7 +68,6 @@ def run_scanoss_py(path_to_scan: str, output_path: str = "", format: list = [],
67
68
  nb_threads=num_threads if num_threads > 0 else 10,
68
69
  scanoss_settings=scanoss_settings
69
70
  )
70
-
71
71
  output_buffer = io.StringIO()
72
72
  with contextlib.redirect_stdout(output_buffer), contextlib.redirect_stderr(output_buffer):
73
73
  scanner.scan_folder_with_options(scan_dir=path_to_scan)
@@ -75,6 +75,7 @@ def run_scanoss_py(path_to_scan: str, output_path: str = "", format: list = [],
75
75
  api_limit_exceed = "due to service limits being exceeded" in captured_output
76
76
 
77
77
  if os.path.isfile(output_json_file):
78
+ logger.debug("|---SCANOSS Parsing")
78
79
  with open(output_json_file, "r") as st_json:
79
80
  st_python = json.load(st_json)
80
81
  for key_to_exclude in excluded_files:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fosslight_source
3
- Version: 2.2.13
3
+ Version: 2.2.14
4
4
  Summary: FOSSLight Source Scanner
5
5
  Author: LG Electronics
6
6
  License-Expression: Apache-2.0
@@ -24,11 +24,12 @@ Requires-Dist: fosslight_util>=2.1.37
24
24
  Requires-Dist: PyYAML
25
25
  Requires-Dist: wheel>=0.38.1
26
26
  Requires-Dist: intbitset
27
- Requires-Dist: fosslight_binary>=5.0.0
27
+ Requires-Dist: fosslight_binary>=5.1.22
28
28
  Requires-Dist: scancode-toolkit>=32.0.2
29
29
  Requires-Dist: fingerprints==1.2.3
30
30
  Requires-Dist: normality==2.6.1
31
31
  Requires-Dist: psycopg2-binary>=2.9.10; python_version >= "3.13"
32
+ Requires-Dist: tqdm
32
33
  Dynamic: license-file
33
34
 
34
35
  <!--
@@ -6,10 +6,11 @@ fosslight_util>=2.1.37
6
6
  PyYAML
7
7
  wheel>=0.38.1
8
8
  intbitset
9
- fosslight_binary>=5.0.0
9
+ fosslight_binary>=5.1.22
10
10
  scancode-toolkit>=32.0.2
11
11
  fingerprints==1.2.3
12
12
  normality==2.6.1
13
+ tqdm
13
14
 
14
15
  [:python_version >= "3.13"]
15
16
  psycopg2-binary>=2.9.10