Skip to content

Commit

Permalink
cmake: zephyr_modules: Add west executable argument
Browse files Browse the repository at this point in the history
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 May 3, 2019
1 parent eba3f49 commit 06365a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cmake/zephyr_module.cmake
Expand Up @@ -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}
Expand Down
4 changes: 3 additions & 1 deletion scripts/zephyr_module.py
Expand Up @@ -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()
Expand Down

0 comments on commit 06365a5

Please sign in to comment.