fosslight-source 2.2.3__tar.gz → 2.2.4__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.
- {fosslight_source-2.2.3/src/fosslight_source.egg-info → fosslight_source-2.2.4}/PKG-INFO +1 -1
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/setup.py +1 -1
- fosslight_source-2.2.4/src/fosslight_source/_help.py +67 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source/cli.py +5 -3
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source/run_scanoss.py +10 -7
- {fosslight_source-2.2.3 → fosslight_source-2.2.4/src/fosslight_source.egg-info}/PKG-INFO +1 -1
- fosslight_source-2.2.3/src/fosslight_source/_help.py +0 -44
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/LICENSE +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/MANIFEST.in +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/README.md +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/requirements.txt +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/setup.cfg +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source/__init__.py +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source/_license_matched.py +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source/_parsing_scancode_file_item.py +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source/_parsing_scanoss_file.py +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source/_scan_item.py +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source/run_manifest_extractor.py +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source/run_scancode.py +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source/run_spdx_extractor.py +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source.egg-info/SOURCES.txt +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source.egg-info/dependency_links.txt +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source.egg-info/entry_points.txt +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source.egg-info/requires.txt +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source.egg-info/top_level.txt +0 -0
- {fosslight_source-2.2.3 → fosslight_source-2.2.4}/tests/test_tox.py +0 -0
|
@@ -14,7 +14,7 @@ with open('requirements.txt', 'r', 'utf-8') as f:
|
|
|
14
14
|
if __name__ == "__main__":
|
|
15
15
|
setup(
|
|
16
16
|
name='fosslight_source',
|
|
17
|
-
version='2.2.
|
|
17
|
+
version='2.2.4',
|
|
18
18
|
package_dir={"": "src"},
|
|
19
19
|
packages=find_packages(where='src'),
|
|
20
20
|
description='FOSSLight Source Scanner',
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# Copyright (c) 2021 LG Electronics Inc.
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
from fosslight_util.help import PrintHelpMsg, print_package_version
|
|
6
|
+
from fosslight_util.output_format import SUPPORT_FORMAT
|
|
7
|
+
|
|
8
|
+
_HELP_MESSAGE_SOURCE_SCANNER = f"""
|
|
9
|
+
📖 Usage
|
|
10
|
+
────────────────────────────────────────────────────────────────────
|
|
11
|
+
fosslight_source [options] <arguments>
|
|
12
|
+
|
|
13
|
+
📝 Description
|
|
14
|
+
────────────────────────────────────────────────────────────────────
|
|
15
|
+
FOSSLight Source Scanner analyzes source code to detect copyright and
|
|
16
|
+
license information using several modes.
|
|
17
|
+
|
|
18
|
+
Note: Build scripts, binary files, and test directories are automatically
|
|
19
|
+
excluded from analysis.
|
|
20
|
+
|
|
21
|
+
📚 Guide: https://fosslight.org/fosslight-guide/scanner/2_source.html
|
|
22
|
+
|
|
23
|
+
⚙️ General Options
|
|
24
|
+
────────────────────────────────────────────────────────────────────
|
|
25
|
+
-p <path> Source path to analyze (default: current directory)
|
|
26
|
+
-o <path> Output file path or directory
|
|
27
|
+
-f <format> Output formats: {', '.join(SUPPORT_FORMAT)}
|
|
28
|
+
(multiple formats can be specified, separated by space)
|
|
29
|
+
-e <pattern> Exclude paths from analysis (files and directories)
|
|
30
|
+
⚠️ IMPORTANT: Always wrap in quotes to avoid shell expansion
|
|
31
|
+
Example: fosslight_source -e "dev/" "tests/" "*.jar"
|
|
32
|
+
-m Generate detailed scan results on separate sheets
|
|
33
|
+
-h Show this help message
|
|
34
|
+
-v Show version information
|
|
35
|
+
|
|
36
|
+
🔍 Scanner-Specific Options
|
|
37
|
+
────────────────────────────────────────────────────────────────────
|
|
38
|
+
-s <mode> Choose mode: scancode, scanoss, kb, or all(default)
|
|
39
|
+
-c <number> Number of CPU cores/threads to use for scanning
|
|
40
|
+
-t <seconds> Timeout in seconds for ScanCode scanning
|
|
41
|
+
-j Generate raw scanner results in JSON format
|
|
42
|
+
--no_correction Skip OSS information correction with sbom-info.yaml
|
|
43
|
+
--correct_fpath <path> Path to custom sbom-info.yaml file
|
|
44
|
+
|
|
45
|
+
💡 Examples
|
|
46
|
+
────────────────────────────────────────────────────────────────────
|
|
47
|
+
# Scan current directory
|
|
48
|
+
fosslight_source
|
|
49
|
+
|
|
50
|
+
# Scan specific path with exclusions
|
|
51
|
+
fosslight_source -p /path/to/source -e "test/" "node_modules/"
|
|
52
|
+
|
|
53
|
+
# Generate output in specific format
|
|
54
|
+
fosslight_source -f excel -o results/
|
|
55
|
+
|
|
56
|
+
# Generate raw scanner results in JSON format
|
|
57
|
+
fosslight_source -p /path/to/source -j
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def print_version(pkg_name: str) -> None:
|
|
62
|
+
print_package_version(pkg_name, "FOSSLight Source Scanner Version:")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def print_help_msg_source_scanner() -> None:
|
|
66
|
+
helpMsg = PrintHelpMsg(_HELP_MESSAGE_SOURCE_SCANNER)
|
|
67
|
+
helpMsg.print_help_msg(True)
|
|
@@ -370,7 +370,7 @@ def run_scanners(
|
|
|
370
370
|
if output_path == "":
|
|
371
371
|
output_path = os.getcwd()
|
|
372
372
|
final_output_path = output_path
|
|
373
|
-
output_path = os.path.join(os.path.dirname(output_path), '.
|
|
373
|
+
output_path = os.path.join(os.path.dirname(output_path), f'.fosslight_temp_{start_time}')
|
|
374
374
|
|
|
375
375
|
logger, result_log = init_log(os.path.join(output_path, f"fosslight_log_src_{start_time}.txt"),
|
|
376
376
|
True, logging.INFO, logging.DEBUG, PKG_NAME, path_to_scan, path_to_exclude)
|
|
@@ -404,8 +404,10 @@ def run_scanners(
|
|
|
404
404
|
excluded_files)
|
|
405
405
|
excluded_files = set(excluded_files) if excluded_files else set()
|
|
406
406
|
if selected_scanner in ['scanoss', 'all']:
|
|
407
|
-
scanoss_result, api_limit_exceed = run_scanoss_py(path_to_scan,
|
|
408
|
-
|
|
407
|
+
scanoss_result, api_limit_exceed = run_scanoss_py(path_to_scan, output_path, formats, True, num_cores,
|
|
408
|
+
excluded_path_with_default_exclusion, excluded_files,
|
|
409
|
+
write_json_file)
|
|
410
|
+
|
|
409
411
|
if selected_scanner in SCANNER_TYPE:
|
|
410
412
|
run_kb = True if selected_scanner in ['kb', 'all'] else False
|
|
411
413
|
spdx_downloads, manifest_licenses = metadata_collector(path_to_scan, excluded_files)
|
|
@@ -8,8 +8,8 @@ import importlib_metadata
|
|
|
8
8
|
import warnings
|
|
9
9
|
import logging
|
|
10
10
|
import json
|
|
11
|
+
from typing import Tuple
|
|
11
12
|
import fosslight_util.constant as constant
|
|
12
|
-
from fosslight_util.output_format import check_output_formats_v2 # , write_output_file
|
|
13
13
|
from ._parsing_scanoss_file import parsing_scan_result # scanoss
|
|
14
14
|
from ._parsing_scanoss_file import parsing_extra_info # scanoss
|
|
15
15
|
from scanoss.scanner import Scanner, ScanType
|
|
@@ -19,7 +19,6 @@ import contextlib
|
|
|
19
19
|
logger = logging.getLogger(constant.LOGGER_NAME)
|
|
20
20
|
warnings.filterwarnings("ignore", category=FutureWarning)
|
|
21
21
|
_PKG_NAME = "fosslight_source"
|
|
22
|
-
SCANOSS_RESULT_FILE = "scanner_output.wfp"
|
|
23
22
|
SCANOSS_OUTPUT_FILE = "scanoss_raw_result.json"
|
|
24
23
|
|
|
25
24
|
|
|
@@ -27,9 +26,10 @@ def get_scanoss_extra_info(scanned_result: dict) -> list:
|
|
|
27
26
|
return parsing_extra_info(scanned_result)
|
|
28
27
|
|
|
29
28
|
|
|
30
|
-
def run_scanoss_py(path_to_scan: str,
|
|
29
|
+
def run_scanoss_py(path_to_scan: str, output_path: str = "", format: list = [],
|
|
31
30
|
called_by_cli: bool = False, num_threads: int = -1,
|
|
32
|
-
path_to_exclude: list = [], excluded_files: set = None
|
|
31
|
+
path_to_exclude: list = [], excluded_files: set = None,
|
|
32
|
+
write_json_file: bool = False) -> Tuple[list, bool]:
|
|
33
33
|
"""
|
|
34
34
|
Run scanoss.py for the given path.
|
|
35
35
|
|
|
@@ -40,7 +40,6 @@ def run_scanoss_py(path_to_scan: str, output_file_name: str = "", format: list =
|
|
|
40
40
|
:param write_json_file: if requested, keep the raw files.
|
|
41
41
|
:return scanoss_file_list: list of ScanItem (scanned result by files).
|
|
42
42
|
"""
|
|
43
|
-
success, msg, output_path, output_files, output_extensions, formats = check_output_formats_v2(output_file_name, format)
|
|
44
43
|
|
|
45
44
|
scanoss_file_list = []
|
|
46
45
|
api_limit_exceed = False
|
|
@@ -49,10 +48,10 @@ def run_scanoss_py(path_to_scan: str, output_file_name: str = "", format: list =
|
|
|
49
48
|
except Exception as error:
|
|
50
49
|
logger.warning(f"{error}. Skipping scan with scanoss.")
|
|
51
50
|
logger.warning("Please install scanoss and dataclasses before run fosslight_source with scanoss option.")
|
|
52
|
-
return scanoss_file_list
|
|
51
|
+
return scanoss_file_list, api_limit_exceed
|
|
53
52
|
|
|
54
53
|
output_json_file = os.path.join(output_path, SCANOSS_OUTPUT_FILE)
|
|
55
|
-
if os.path.exists(output_json_file):
|
|
54
|
+
if os.path.exists(output_json_file):
|
|
56
55
|
os.remove(output_json_file)
|
|
57
56
|
|
|
58
57
|
try:
|
|
@@ -82,6 +81,10 @@ def run_scanoss_py(path_to_scan: str, output_file_name: str = "", format: list =
|
|
|
82
81
|
st_python = json.load(st_json)
|
|
83
82
|
scanoss_file_list = parsing_scan_result(st_python, excluded_files)
|
|
84
83
|
|
|
84
|
+
if not write_json_file:
|
|
85
|
+
if os.path.isfile(output_json_file):
|
|
86
|
+
os.remove(output_json_file)
|
|
87
|
+
|
|
85
88
|
except Exception as error:
|
|
86
89
|
logger.debug(f"SCANOSS Parsing {path_to_scan}: {error}")
|
|
87
90
|
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
# Copyright (c) 2021 LG Electronics Inc.
|
|
4
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
from fosslight_util.help import PrintHelpMsg, print_package_version
|
|
6
|
-
from fosslight_util.output_format import SUPPORT_FORMAT
|
|
7
|
-
|
|
8
|
-
_HELP_MESSAGE_SOURCE_SCANNER = f"""
|
|
9
|
-
FOSSLight Source Scanner Usage: fosslight_source [option1] <arg1> [option2] <arg2>...
|
|
10
|
-
|
|
11
|
-
FOSSLight Source Scanner uses ScanCode and SCANOSS, the source code scanners, to detect
|
|
12
|
-
the copyright and license phrases contained in the file.
|
|
13
|
-
Some files (ex- build script), binary files, directory and files in specific
|
|
14
|
-
directories (ex-test) are excluded from the result.
|
|
15
|
-
|
|
16
|
-
Options:
|
|
17
|
-
Optional
|
|
18
|
-
-p <source_path>\t Path to analyze source (Default: current directory)
|
|
19
|
-
-h\t\t\t Print help message
|
|
20
|
-
-v\t\t\t Print FOSSLight Source Scanner version
|
|
21
|
-
-m\t\t\t Print additional information for scan result on separate sheets
|
|
22
|
-
-e <path>\t\t Path to exclude from analysis (files and directories)
|
|
23
|
-
\t\t\t * IMPORTANT: Always wrap patterns in double quotes ("") to avoid shell expansion.
|
|
24
|
-
\t\t\t Example) fosslight_source -e "dev/" "tests/"
|
|
25
|
-
-o <output_path>\t Output path (Path or file name)
|
|
26
|
-
-f <format>\t\t Output file formats
|
|
27
|
-
\t\t\t ({', '.join(SUPPORT_FORMAT)})
|
|
28
|
-
\t\t\t Multiple formats can be specified separated by space.
|
|
29
|
-
Options only for FOSSLight Source Scanner
|
|
30
|
-
-s <scanner>\t Select which scanner to be run (scancode, scanoss, kb, all)
|
|
31
|
-
-j\t\t\t Generate raw result of scanners in json format
|
|
32
|
-
-t <float>\t\t Stop scancode scanning if scanning takes longer than a timeout in seconds.
|
|
33
|
-
-c <core>\t\t Select the number of cores to be scanned with ScanCode or threads with SCANOSS.
|
|
34
|
-
--no_correction\t Enter if you don't want to correct OSS information with sbom-info.yaml
|
|
35
|
-
--correct_fpath <path> Path to the sbom-info.yaml file"""
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def print_version(pkg_name: str) -> None:
|
|
39
|
-
print_package_version(pkg_name, "FOSSLight Source Scanner Version:")
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def print_help_msg_source_scanner() -> None:
|
|
43
|
-
helpMsg = PrintHelpMsg(_HELP_MESSAGE_SOURCE_SCANNER)
|
|
44
|
-
helpMsg.print_help_msg(True)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source/_parsing_scanoss_file.py
RENAMED
|
File without changes
|
|
File without changes
|
{fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source/run_manifest_extractor.py
RENAMED
|
File without changes
|
|
File without changes
|
{fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source/run_spdx_extractor.py
RENAMED
|
File without changes
|
|
File without changes
|
{fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source.egg-info/requires.txt
RENAMED
|
File without changes
|
{fosslight_source-2.2.3 → fosslight_source-2.2.4}/src/fosslight_source.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|