Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions scripts/west_commands/sbom/scancode_toolkit_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import json
import os
import re
import shutil
from tempfile import NamedTemporaryFile

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