mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-09 22:08:56 +08:00
build(cmake): probe kconfiglib via import kconfiglib not menuconfig
cmake/kconfig.cmake verified that kconfiglib is installed by running
`python -c "import menuconfig"`. The `menuconfig` entry point pulls in
the standard library `curses` module, which is missing on a number of
hosts we care about:
- the macOS arm64 hostedtoolcache Python (3.10.11) used by the
`MacOS build` job, which now fails the kconfiglib check during
cmake configure of px4_sitl_default
- any Windows Python that does not have windows-curses installed
(kconfiglib stopped pulling it in automatically at 13.0)
We never invoke menuconfig from the build itself - only the standalone
`make menuconfig` developer target does, and there the curses
dependency is unavoidable. Probe with `import kconfiglib` instead, so
configure succeeds anywhere kconfiglib (the actual dependency) is
importable. Also tighten the failure check to `NOT ret EQUAL "0"` so
non-zero return codes other than 1 are caught.
Signed-off-by: Nuno Marques <n.marques21@hotmail.com>
This commit is contained in:
+8
-2
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user