Skip to content

Commit 14f89bf

Browse files
committed
scripts: Add sbom scancode-toolkit user info
Since scancode-toolkit is not part of ncs sdk anymore, the user needs to install scancode manually. Signed-off-by: Nicolae Dicu <[email protected]>
1 parent e5a583b commit 14f89bf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

scripts/west_commands/sbom/scancode_toolkit_detector.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import json
1212
import os
1313
import re
14+
import shutil
1415
from tempfile import NamedTemporaryFile
1516

1617
from args import args
@@ -23,6 +24,14 @@
2324
def check_scancode():
2425
'''Checks if "scancode --version" works correctly. If not, raises exception with information
2526
for user.'''
27+
if shutil.which(args.scancode) is None:
28+
raise SbomException(f'Cannot find scancode executable "{args.scancode}".\n'
29+
'Install the SBOM requirements with:\n'
30+
' pip3 install -r scripts/requirements-west-ncs-sbom.txt\n'
31+
'Use --force-reinstall --no-cache-dir options if it still fails\n'
32+
'Pass "--scancode=/path/to/scancode" if the scancode executable is'
33+
'not available on PATH.')
34+
2635
try:
2736
command_execute(args.scancode, '--version', allow_stderr=True)
2837
except Exception as ex:

0 commit comments

Comments
 (0)