[PATCH] build: error out when missing elftools python module
Bruce Richardson
bruce.richardson at intel.com
Fri Jun 27 17:27:59 CEST 2025
In the case where we use the meson python "find_installation()" function
to get our python binary, we can fail the configure/setup step if the
elftools module is missing. This avoids later errors on build when the
module is missed.
Old output (error logged and config continues):
Program python3 (elftools) found: NO
New output:
Program python3 found: YES (/usr/bin/python3)
Program python3 (elftools) found: NO
../buildtools/meson.build:15:31: ERROR: python3 is missing modules: elftools
Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
buildtools/meson.build | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/buildtools/meson.build b/buildtools/meson.build
index 7b5e449cdb..12abbdff9c 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -9,8 +9,11 @@ python3_required_modules = []
if host_machine.system() != 'windows'
python3_required_modules = ['elftools']
endif
-python3 = import('python').find_installation('python3', required: false, modules: python3_required_modules)
+python3 = import('python').find_installation('python3', required: false)
if python3.found()
+ # If python3 is found, check that we have pyelftools installed.
+ python3 = import('python').find_installation('python3', required: true,
+ modules: python3_required_modules)
py3 = [python3]
else
py3 = ['meson', 'runpython']
--
2.48.1
More information about the dev
mailing list