fosslight-source 2.1.5__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 +17 -4
- fosslight_source/run_scanoss.py +10 -2
- {fosslight_source-2.1.5.dist-info → fosslight_source-2.1.7.dist-info}/METADATA +5 -4
- {fosslight_source-2.1.5.dist-info → fosslight_source-2.1.7.dist-info}/RECORD +8 -8
- {fosslight_source-2.1.5.dist-info → fosslight_source-2.1.7.dist-info}/LICENSE +0 -0
- {fosslight_source-2.1.5.dist-info → fosslight_source-2.1.7.dist-info}/WHEEL +0 -0
- {fosslight_source-2.1.5.dist-info → fosslight_source-2.1.7.dist-info}/entry_points.txt +0 -0
- {fosslight_source-2.1.5.dist-info → fosslight_source-2.1.7.dist-info}/top_level.txt +0 -0
fosslight_source/cli.py
CHANGED
|
@@ -12,6 +12,7 @@ from datetime import datetime
|
|
|
12
12
|
import fosslight_util.constant as constant
|
|
13
13
|
from fosslight_util.set_log import init_log
|
|
14
14
|
from fosslight_util.timer_thread import TimerThread
|
|
15
|
+
from fosslight_util.exclude import excluding_files
|
|
15
16
|
from ._help import print_version, print_help_msg_source_scanner
|
|
16
17
|
from ._license_matched import get_license_list_to_print
|
|
17
18
|
from fosslight_util.output_format import check_output_formats_v2, write_output_file
|
|
@@ -147,7 +148,7 @@ def create_report_file(
|
|
|
147
148
|
output_path: str = "", output_files: list = [],
|
|
148
149
|
output_extensions: list = [], correct_mode: bool = True,
|
|
149
150
|
correct_filepath: str = "", path_to_scan: str = "", path_to_exclude: list = [],
|
|
150
|
-
formats: list = []
|
|
151
|
+
formats: list = [], excluded_file_list: list = [], api_limit_exceed: bool = False
|
|
151
152
|
) -> 'ScannerItem':
|
|
152
153
|
"""
|
|
153
154
|
Create report files for given scanned result.
|
|
@@ -211,6 +212,9 @@ def create_report_file(
|
|
|
211
212
|
scan_item.set_cover_comment(f"Total number of files : {files_count}")
|
|
212
213
|
scan_item.set_cover_comment(f"Removed files : {removed_files_count}")
|
|
213
214
|
|
|
215
|
+
if api_limit_exceed:
|
|
216
|
+
scan_item.set_cover_comment("(Some of) SCANOSS scan was skipped. (API limits being exceeded)")
|
|
217
|
+
|
|
214
218
|
if not merged_result:
|
|
215
219
|
if files_count < 1:
|
|
216
220
|
scan_item.set_cover_comment("(No file detected.)")
|
|
@@ -219,6 +223,12 @@ def create_report_file(
|
|
|
219
223
|
|
|
220
224
|
if merged_result:
|
|
221
225
|
sheet_list = {}
|
|
226
|
+
# Remove results that are in excluding file list
|
|
227
|
+
for i in range(len(merged_result) - 1, -1, -1): # Iterate from last to first
|
|
228
|
+
item_path = merged_result[i].source_name_or_path # Assuming SourceItem has 'file_path' attribute
|
|
229
|
+
if item_path in excluded_file_list:
|
|
230
|
+
del merged_result[i] # Delete matching item
|
|
231
|
+
|
|
222
232
|
scan_item.append_file_items(merged_result, PKG_NAME)
|
|
223
233
|
|
|
224
234
|
if selected_scanner == 'scanoss':
|
|
@@ -262,6 +272,7 @@ def create_report_file(
|
|
|
262
272
|
|
|
263
273
|
|
|
264
274
|
def merge_results(scancode_result: list = [], scanoss_result: list = [], spdx_downloads: dict = {}) -> list:
|
|
275
|
+
|
|
265
276
|
"""
|
|
266
277
|
Merge scanner results and spdx parsing result.
|
|
267
278
|
:param scancode_result: list of scancode results in SourceItem.
|
|
@@ -329,6 +340,7 @@ def run_scanners(
|
|
|
329
340
|
|
|
330
341
|
logger, result_log = init_log(os.path.join(output_path, f"fosslight_log_src_{start_time}.txt"),
|
|
331
342
|
True, logging.INFO, logging.DEBUG, PKG_NAME, path_to_scan, path_to_exclude)
|
|
343
|
+
excluded_file_list = excluding_files(path_to_exclude, path_to_scan)
|
|
332
344
|
|
|
333
345
|
if '.xlsx' not in output_extensions and print_matched_text:
|
|
334
346
|
logger.warning("-m option is only available for excel.")
|
|
@@ -341,14 +353,15 @@ def run_scanners(
|
|
|
341
353
|
print_matched_text, formats, called_by_cli,
|
|
342
354
|
time_out, correct_mode, correct_filepath)
|
|
343
355
|
if selected_scanner == 'scanoss' or selected_scanner == 'all' or selected_scanner == '':
|
|
344
|
-
scanoss_result = run_scanoss_py(path_to_scan, output_file_name, formats, True, write_json_file,
|
|
345
|
-
|
|
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)
|
|
346
358
|
if selected_scanner in SCANNER_TYPE:
|
|
347
359
|
spdx_downloads = get_spdx_downloads(path_to_scan, path_to_exclude)
|
|
348
360
|
merged_result = merge_results(scancode_result, scanoss_result, spdx_downloads)
|
|
349
361
|
scan_item = create_report_file(start_time, merged_result, license_list, scanoss_result, selected_scanner,
|
|
350
362
|
print_matched_text, output_path, output_files, output_extensions, correct_mode,
|
|
351
|
-
correct_filepath, path_to_scan, path_to_exclude, formats
|
|
363
|
+
correct_filepath, path_to_scan, path_to_exclude, formats, excluded_file_list,
|
|
364
|
+
api_limit_exceed)
|
|
352
365
|
else:
|
|
353
366
|
print_help_msg_source_scanner()
|
|
354
367
|
result_log[RESULT_KEY] = "Unsupported scanner"
|
fosslight_source/run_scanoss.py
CHANGED
|
@@ -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
|
-
|
|
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.
|
|
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,14 +16,15 @@ 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
|
|
19
|
+
Requires-Dist: scanoss>=1.18.0
|
|
20
20
|
Requires-Dist: XlsxWriter
|
|
21
|
-
Requires-Dist: fosslight-util>=2.1.
|
|
21
|
+
Requires-Dist: fosslight-util>=2.1.10
|
|
22
22
|
Requires-Dist: PyYAML
|
|
23
23
|
Requires-Dist: wheel>=0.38.1
|
|
24
24
|
Requires-Dist: intbitset
|
|
25
25
|
Requires-Dist: fosslight-binary>=5.0.0
|
|
26
26
|
Requires-Dist: psycopg2-binary==2.9.9
|
|
27
|
+
Requires-Dist: beautifulsoup4==4.12.*
|
|
27
28
|
Requires-Dist: scancode-toolkit==32.2.*; sys_platform != "darwin"
|
|
28
29
|
Requires-Dist: scancode-toolkit==32.0.*; sys_platform == "darwin"
|
|
29
30
|
|
|
@@ -64,7 +65,7 @@ Please see the [**User Guide**](https://fosslight.org/fosslight-guide-en/scanner
|
|
|
64
65
|
## 👏 Contributing Guide
|
|
65
66
|
|
|
66
67
|
We always welcome your contributions.
|
|
67
|
-
Please see the [CONTRIBUTING guide](https://fosslight.org/
|
|
68
|
+
Please see the [CONTRIBUTING guide](https://fosslight.org/hub-guide-en/contribution/1_contribution.html) for how to contribute.
|
|
68
69
|
|
|
69
70
|
|
|
70
71
|
## 📄 License
|
|
@@ -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=
|
|
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=
|
|
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.
|
|
12
|
-
fosslight_source-2.1.
|
|
13
|
-
fosslight_source-2.1.
|
|
14
|
-
fosslight_source-2.1.
|
|
15
|
-
fosslight_source-2.1.
|
|
16
|
-
fosslight_source-2.1.
|
|
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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|