From 06365a5ed1d919781d8143bf902e4e3091a49270 Mon Sep 17 00:00:00 2001 From: "Sigvart M. Hovland" Date: Thu, 25 Apr 2019 12:27:17 +0200 Subject: [PATCH] cmake: zephyr_modules: Add west executable argument On some systems where you don't have access to `PATH` and you can't set the `ENV{PATH}` variable. You need to be able to pass the path to the west executable down to the python script so it is better for it to be set explicitly than assuming that it exsists as a part of the PATH/executables in the shell being called. Signed-off-by: Sigvart M. Hovland --- cmake/zephyr_module.cmake | 5 +++++ scripts/zephyr_module.py | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/zephyr_module.cmake b/cmake/zephyr_module.cmake index 4ce037d2fe10c1..a0f16c619b9ff5 100644 --- a/cmake/zephyr_module.cmake +++ b/cmake/zephyr_module.cmake @@ -20,12 +20,17 @@ endif() set(KCONFIG_MODULES_FILE ${CMAKE_BINARY_DIR}/Kconfig.modules) +if(WEST) + set(WEST_ARG "--west-path" ${WEST}) +endif() + if(WEST OR ZEPHYR_MODULES) # Zephyr module uses west, so only call it if west is installed or # ZEPHYR_MODULES was provided as argument to CMake. execute_process( COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/zephyr_module.py + ${WEST_ARG} ${ZEPHYR_MODULES_ARG} ${ZEPHYR_EXTRA_MODULES_ARG} --kconfig-out ${KCONFIG_MODULES_FILE} diff --git a/scripts/zephyr_module.py b/scripts/zephyr_module.py index 485eac3df6db42..f384e81e7d4dca 100755 --- a/scripts/zephyr_module.py +++ b/scripts/zephyr_module.py @@ -119,10 +119,12 @@ def main(): 'list`') parser.add_argument('-x', '--extra-modules', nargs='+', help='List of extra modules to parse') + parser.add_argument('-w', '--west-path', default='west', + help='Path to west executable') args = parser.parse_args() if args.modules is None: - p = subprocess.Popen(['west', 'list', '--format={posixpath}'], + p = subprocess.Popen([args.west_path, 'list', '--format={posixpath}'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate()