fosslight-source 2.1.6__py3-none-any.whl → 2.1.7__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/cli.py CHANGED
@@ -148,7 +148,7 @@ def create_report_file(
148
148
  output_path: str = "", output_files: list = [],
149
149
  output_extensions: list = [], correct_mode: bool = True,
150
150
  correct_filepath: str = "", path_to_scan: str = "", path_to_exclude: list = [],
151
- formats: list = [], excluded_file_list: list = []
151
+ formats: list = [], excluded_file_list: list = [], api_limit_exceed: bool = False
152
152
  ) -> 'ScannerItem':
153
153
  """
154
154
  Create report files for given scanned result.
@@ -212,6 +212,9 @@ def create_report_file(
212
212
  scan_item.set_cover_comment(f"Total number of files : {files_count}")
213
213
  scan_item.set_cover_comment(f"Removed files : {removed_files_count}")
214
214
 
215
+ if api_limit_exceed:
216
+ scan_item.set_cover_comment("(Some of) SCANOSS scan was skipped. (API limits being exceeded)")
217
+
215
218
  if not merged_result:
216
219
  if files_count < 1:
217
220
  scan_item.set_cover_comment("(No file detected.)")
@@ -350,14 +353,15 @@ def run_scanners(
350
353
  print_matched_text, formats, called_by_cli,
351
354
  time_out, correct_mode, correct_filepath)
352
355
  if selected_scanner == 'scanoss' or selected_scanner == 'all' or selected_scanner == '':
353
- scanoss_result = run_scanoss_py(path_to_scan, output_file_name, formats, True, write_json_file, num_cores,
354
- path_to_exclude)
356
+ scanoss_result, api_limit_exceed = run_scanoss_py(path_to_scan, output_file_name, formats, True, write_json_file,
357
+ num_cores, path_to_exclude)
355
358
  if selected_scanner in SCANNER_TYPE:
356
359
  spdx_downloads = get_spdx_downloads(path_to_scan, path_to_exclude)
357
360
  merged_result = merge_results(scancode_result, scanoss_result, spdx_downloads)
358
361
  scan_item = create_report_file(start_time, merged_result, license_list, scanoss_result, selected_scanner,
359
362
  print_matched_text, output_path, output_files, output_extensions, correct_mode,
360
- correct_filepath, path_to_scan, path_to_exclude, formats, excluded_file_list)
363
+ correct_filepath, path_to_scan, path_to_exclude, formats, excluded_file_list,
364
+ api_limit_exceed)
361
365
  else:
362
366
  print_help_msg_source_scanner()
363
367
  result_log[RESULT_KEY] = "Unsupported scanner"
@@ -17,6 +17,8 @@ from ._parsing_scanoss_file import parsing_extraInfo # scanoss
17
17
  import shutil
18
18
  from pathlib import Path
19
19
  from scanoss.scanner import Scanner, ScanType
20
+ import io
21
+ import contextlib
20
22
 
21
23
  logger = logging.getLogger(constant.LOGGER_NAME)
22
24
  warnings.filterwarnings("ignore", category=FutureWarning)
@@ -75,7 +77,13 @@ def run_scanoss_py(path_to_scan: str, output_file_name: str = "", format: list =
75
77
  scan_options=ScanType.SCAN_SNIPPETS.value,
76
78
  nb_threads=num_threads if num_threads > 0 else 10
77
79
  )
78
- scanner.scan_folder_with_options(scan_dir=path_to_scan)
80
+
81
+ output_buffer = io.StringIO()
82
+ with contextlib.redirect_stdout(output_buffer), contextlib.redirect_stderr(output_buffer):
83
+ scanner.scan_folder_with_options(scan_dir=path_to_scan)
84
+ captured_output = output_buffer.getvalue()
85
+ api_limit_exceed = "due to service limits being exceeded" in captured_output
86
+ logger.debug(f"{captured_output}")
79
87
 
80
88
  if os.path.isfile(output_json_file):
81
89
  total_files_to_excluded = []
@@ -117,4 +125,4 @@ def run_scanoss_py(path_to_scan: str, output_file_name: str = "", format: list =
117
125
  except Exception as error:
118
126
  logger.debug(f"Moving scanoss raw files failed.: {error}")
119
127
 
120
- return scanoss_file_list
128
+ return scanoss_file_list, api_limit_exceed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fosslight-source
3
- Version: 2.1.6
3
+ Version: 2.1.7
4
4
  Summary: FOSSLight Source Scanner
5
5
  Home-page: https://github.com/fosslight/fosslight_source_scanner
6
6
  Author: LG Electronics
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.11
16
16
  Requires-Python: >=3.8
17
17
  Description-Content-Type: text/markdown
18
18
  Requires-Dist: pyparsing
19
- Requires-Dist: scanoss<=1.14.0
19
+ Requires-Dist: scanoss>=1.18.0
20
20
  Requires-Dist: XlsxWriter
21
21
  Requires-Dist: fosslight-util>=2.1.10
22
22
  Requires-Dist: PyYAML
@@ -4,13 +4,13 @@ fosslight_source/_license_matched.py,sha256=-3H881XQjFDafRttBsuboS3VbCPYEvPH1pwW
4
4
  fosslight_source/_parsing_scancode_file_item.py,sha256=4U8wTuuNm-2-hanTxiQr2FvHTBrf2ZwESyea_E8caHU,13466
5
5
  fosslight_source/_parsing_scanoss_file.py,sha256=Ss6BWTdT1Q43xTT9GBwL6XyzHT2p57ymVm04NL76Vbg,4506
6
6
  fosslight_source/_scan_item.py,sha256=2RdnH5ZvrD7yjGxaHAIgSLmhq0dyW1379RScqPYJtOI,5679
7
- fosslight_source/cli.py,sha256=DHlqtVx1EfZAfbHL2iED0uOBI1MRJsvmSrQ9zeHbSm8,16381
7
+ fosslight_source/cli.py,sha256=yQLuPW05MWWHJKM8tH8P4R1eBHMSW80Z6BQNEAEtgBw,16639
8
8
  fosslight_source/run_scancode.py,sha256=leq-FuGwX-kBg-sNZXQ-DSKy-uTj7w2QBFeOLgyvPxc,7094
9
- fosslight_source/run_scanoss.py,sha256=Z7iebJk9NJegoI2m2PT4hw3Qs294KhFwWxpcEnWn15U,5354
9
+ fosslight_source/run_scanoss.py,sha256=8wu3sa-YBqjfb5x2dbDJuAdw3rrExueOW23WdzqDCaU,5721
10
10
  fosslight_source/run_spdx_extractor.py,sha256=Hr9sTv06cJaVITy8amwexIW2FV8_rUcFw6hKmR9ZYws,1990
11
- fosslight_source-2.1.6.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
12
- fosslight_source-2.1.6.dist-info/METADATA,sha256=KR6sq0TuE2CbfPJnp9m_iHAwORwCwOsX3j59_6zj_yU,3433
13
- fosslight_source-2.1.6.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
14
- fosslight_source-2.1.6.dist-info/entry_points.txt,sha256=NzFURHC4L8uf1PmnZ2uGQcZxR7UbYCgjetb_9aPHV-w,114
15
- fosslight_source-2.1.6.dist-info/top_level.txt,sha256=C2vw-0OIent84Vq-UEk1gt_kK1EL8dIItzBzp3WNyA4,17
16
- fosslight_source-2.1.6.dist-info/RECORD,,
11
+ fosslight_source-2.1.7.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
12
+ fosslight_source-2.1.7.dist-info/METADATA,sha256=Ced16udUh8-n9kS_uIsB1hY8x-EhY_p3iP75q95t1Es,3433
13
+ fosslight_source-2.1.7.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
14
+ fosslight_source-2.1.7.dist-info/entry_points.txt,sha256=NzFURHC4L8uf1PmnZ2uGQcZxR7UbYCgjetb_9aPHV-w,114
15
+ fosslight_source-2.1.7.dist-info/top_level.txt,sha256=C2vw-0OIent84Vq-UEk1gt_kK1EL8dIItzBzp3WNyA4,17
16
+ fosslight_source-2.1.7.dist-info/RECORD,,