Skip to content

Commit

Permalink
scripts: west_command: spdx: Exit with non-zero code on failure
Browse files Browse the repository at this point in the history
If the init or the generation fails, the resulting exit code should be
non-zero.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
  • Loading branch information
pdgendt committed Jan 10, 2025
1 parent bc6eded commit c182817
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/west_commands/spdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ def do_run_init(self, args):
if query_ready:
self.inf("initialized; run `west build` then run `west spdx`")
else:
self.err("Couldn't create CMake file-based API query directory")
self.err("You can manually create an empty file at $BUILDDIR/.cmake/api/v1/query/codemodel-v2")
self.die("Couldn't create CMake file-based API query directory\n"
"You can manually create an empty file at "
"$BUILDDIR/.cmake/api/v1/query/codemodel-v2")

def do_run_spdx(self, args):
if not args.build_dir:
Expand Down Expand Up @@ -110,4 +111,5 @@ def do_run_spdx(self, args):
# create the directory
os.makedirs(cfg.spdxDir, exist_ok=False)

makeSPDX(cfg)
if not makeSPDX(cfg):
self.die("Failed to create SPDX output")

0 comments on commit c182817

Please sign in to comment.