scripts: fix west sign when ZEPHYR_BASE is unset
Due to cleanups in west targeted at getting rid of zephyr-specific
code, extension commands can no longer rely on ZEPHYR_BASE being set
in the calling environment at import time (it's still set at run()
time for now, though, to keep west build working).
Add a new helper to make dealing with this easier from west sign.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
diff --git a/scripts/west_commands/sign.py b/scripts/west_commands/sign.py
index 657c2bf..0aad0b2 100644
--- a/scripts/west_commands/sign.py
+++ b/scripts/west_commands/sign.py
@@ -17,11 +17,11 @@
FIND_BUILD_DIR_DESCRIPTION
from runners.core import BuildConfiguration
from zcmake import CMakeCache
-from zephyr_ext_common import Forceable, cached_runner_config
+from zephyr_ext_common import Forceable, cached_runner_config, \
+ zephyr_scripts_path
-# FIXME we should think of a nicer way to manage sys.path
-# for shared Zephyr code.
-sys.path.append(os.path.join(os.environ['ZEPHYR_BASE'], 'scripts', 'dts'))
+sys.path.append(os.path.join(zephyr_scripts_path(), 'dts'))
+
import edtlib
SIGN_DESCRIPTION = '''\
@@ -388,6 +388,5 @@
['-o', out_bin, '-m', 'apl', '-i', '3'] +
[bootloader, kernel])
-
log.inf(quote_sh_list(sign_base))
subprocess.check_call(sign_base)