Skip to content
Permalink
Browse files

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 <sigvart.hovland@nordicsemi.no>
  • Loading branch information...
sigvartmh authored and nashif committed Apr 25, 2019
1 parent eba3f49 commit 06365a5ed1d919781d8143bf902e4e3091a49270
Showing with 8 additions and 1 deletion.
  1. +5 −0 cmake/zephyr_module.cmake
  2. +3 −1 scripts/zephyr_module.py
@@ -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}
@@ -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()

0 comments on commit 06365a5

Please sign in to comment.
You can’t perform that action at this time.