scripts: runners: abstract jlink's missing program support
The runners/jlink.py script has a mechanism for erroring out if a host
tool is not installed. Abstract it into runners/core.py and handle it
from run_common.py. This will let it be used in more places.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
diff --git a/scripts/west_commands/run_common.py b/scripts/west_commands/run_common.py
index 03ef8b3..e755695 100644
--- a/scripts/west_commands/run_common.py
+++ b/scripts/west_commands/run_common.py
@@ -17,7 +17,7 @@
FIND_BUILD_DIR_DESCRIPTION
from west.commands import CommandContextError
-from runners import get_runner_cls, ZephyrBinaryRunner
+from runners import get_runner_cls, ZephyrBinaryRunner, MissingProgram
from zephyr_ext_common import cached_runner_config
@@ -229,7 +229,11 @@
if unknown:
log.die('Runner', runner, 'received unknown arguments:', unknown)
runner = runner_cls.create(cfg, parsed_args)
- runner.run(command_name)
+ try:
+ runner.run(command_name)
+ except MissingProgram as e:
+ log.die('required program', e.filename,
+ 'not found; install it or add its location to PATH')
#