west: sign: add west config [rimage].path = /path/to/rimage
Add a 3rd option besides --tool-path and $PATH
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
diff --git a/scripts/west_commands/sign.py b/scripts/west_commands/sign.py
index c768b27..205470d 100644
--- a/scripts/west_commands/sign.py
+++ b/scripts/west_commands/sign.py
@@ -422,11 +422,15 @@
def sign(self, command, build_dir, build_conf, formats):
args = command.args
- if args.tool_path:
- command.check_force(shutil.which(args.tool_path),
- '--tool-path {}: not an executable'.
- format(args.tool_path))
- tool_path = args.tool_path
+ tool_path = (
+ args.tool_path if args.tool_path else
+ config_get(command.config, 'rimage.path', None)
+ )
+ err_prefix = '--tool-path' if args.tool_path else 'west config'
+
+ if tool_path:
+ command.check_force(shutil.which(tool_path),
+ f'{err_prefix} {tool_path}: not an executable')
else:
tool_path = shutil.which('rimage')
if not tool_path: