Skip to contentSkip to conversation

build: error out when missing elftools python module

PATCH Applied Bruce Richardson 2 participants 2 messages Jun 27, 2025 – Jun 29, 2025 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: error out when missing elftools python module

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

---
 buildtools/meson.build | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
buildtools/meson.build +4 -1
index 7b5e449cdb..12abbdff9c 100644
@@ -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']
Signature · 1 line
2.48.1
#1 lore raw

27/06/2025 17:27, Bruce Richardson:

Quoted 9 lines

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

Quoted 7 lines

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

Applied, thanks.