diff --git a/cmake/kconfig.cmake b/cmake/kconfig.cmake index 898f17c0b5..8c5f9807a0 100644 --- a/cmake/kconfig.cmake +++ b/cmake/kconfig.cmake @@ -1,8 +1,14 @@ set(BOARD_DEFCONFIG ${PX4_CONFIG_FILE} CACHE FILEPATH "path to defconfig" FORCE) set(BOARD_CONFIG ${PX4_BINARY_DIR}/boardconfig CACHE FILEPATH "path to config" FORCE) -execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import menuconfig" RESULT_VARIABLE ret) -if(ret EQUAL "1") +# Verify kconfiglib presence by importing the package itself rather than +# the `menuconfig` entry point. `menuconfig` pulls in the standard +# `curses` module which is not shipped on every Python install (e.g. the +# setup-python interpreter on Windows runners, or some hostedtoolcache +# Pythons on macOS), and we only need kconfiglib for non-interactive +# config generation here. +execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import kconfiglib" RESULT_VARIABLE ret) +if(NOT ret EQUAL "0") message(FATAL_ERROR "kconfiglib is not installed or not in PATH\n" "please install using \"pip3 install kconfiglib\"\n") endif()