Skip to content

Commit 8833d8f

Browse files
authored
Merge pull request #100 from fosslight/develop
Add parameter for Scancode cores
2 parents a71b7e0 + bf0f9da commit 8833d8f

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ typecode-libmagic
55
fosslight_util>=1.4.0
66
PyYAML
77
wheel
8+
packaging<=21.3

src/fosslight_source/cli.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def main():
5151
scanned_result = []
5252
license_list = []
5353
time_out = 120
54+
core = -1
5455

5556
parser = argparse.ArgumentParser(description='FOSSLight Source', prog='fosslight_source', add_help=False)
5657
parser.add_argument('-h', '--help', action='store_true', required=False)
@@ -62,6 +63,7 @@ def main():
6263
parser.add_argument('-f', '--format', nargs=1, type=str, required=False)
6364
parser.add_argument('-s', '--scanner', nargs=1, type=str, required=False, default='all')
6465
parser.add_argument('-t', '--timeout', type=int, required=False, default=120)
66+
parser.add_argument('-c', '--cores', type=int, required=False, default=-1)
6567

6668
args = parser.parse_args()
6769

@@ -84,6 +86,7 @@ def main():
8486
selected_scanner = ''.join(args.scanner)
8587

8688
time_out = args.timeout
89+
core = args.cores
8790

8891
timer = TimerThread()
8992
timer.setDaemon(True)
@@ -103,14 +106,14 @@ def main():
103106
if os.path.isdir(path_to_scan):
104107
if selected_scanner == 'scancode':
105108
success, _result_log["Scan Result"], scanned_result, license_list = run_scan(path_to_scan, output_file_name,
106-
write_json_file, -1, True,
109+
write_json_file, core, True,
107110
print_matched_text, format, True,
108111
time_out)
109112
elif selected_scanner == 'scanoss':
110113
scanned_result = run_scanoss_py(path_to_scan, output_file_name, format, True, write_json_file)
111114
elif selected_scanner == 'all' or selected_scanner == '':
112115
success, _result_log["Scan Result"], scanned_result, license_list = run_all_scanners(path_to_scan, output_file_name,
113-
write_json_file, -1,
116+
write_json_file, core,
114117
print_matched_text, format, True,
115118
time_out)
116119
else:

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ skipdist = true
66

77
[testenv]
88
install_command = pip install {opts} {packages}
9-
whitelist_externals =
9+
allowlist_externals =
1010
cat
1111
rm
1212
ls

0 commit comments

Comments
 (0)