Skip to contentSkip to conversation

meson: use built-in 'modules' helper for python dependencies

PATCH Applied [email protected] 5 participants 7 messages Jun 23, 2024 – Jun 25, 2024 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meson: use built-in 'modules' helper for python dependencies

From: Luca Boccassi <[email protected]>

We now require Meson 0.53 or later, so we can use this feature introduced in 0.51. This also fixes a build failure on SUSE Leap 15.6.

---
 buildtools/meson.build | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
buildtools/meson.build +5 -14
index 72447b60a0..3adf34e1a8 100644
@@ -5,7 +5,11 @@ pkgconf = find_program('pkg-config', 'pkgconf', required: false)
 check_symbols = find_program('check-symbols.sh')
 ldflags_ibverbs_static = find_program('options-ibverbs-static.sh')
 
-python3 = import('python').find_installation(required: false)
+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)
 if python3.found()
     py3 = [python3]
 else
@@ -45,16 +49,3 @@ else
     pmdinfogen += 'elf'
 endif
 
-# TODO: starting from Meson 0.51.0 use
-#     python3 = import('python').find_installation('python',
-#        modules : python3_required_modules)
-python3_required_modules = []
-if host_machine.system() != 'windows'
-    python3_required_modules = ['elftools']
-endif
-foreach module : python3_required_modules
-    script = 'import importlib.util; import sys; exit(importlib.util.find_spec("@0@") is None)'
-    if run_command(py3, '-c', script.format(module), check: false).returncode() != 0
-        error('missing python module: @0@'.format(module))
-    endif
-endforeach
Signature · 1 line
2.43.0
#3 lore raw
Quoted 10 lines · Bruce Richardson
Quoted 8 lines · On Sun, Jun 23, 2024 at 01:30:23PM +0100, [email protected] wrote:

From: Luca Boccassi <[email protected]>

We now require Meson 0.53 or later, so we can use this feature introduced in 0.51. This also fixes a build failure on SUSE Leap 15.6.

Applied, thanks.

Signature · 1 line
David Marchand
#4 lore raw
In reply to [email protected]
Quoted 5 lines · On Sun, Jun 23, 2024 at 2:30 PM <[email protected]> wrote:

From: Luca Boccassi <[email protected]>

We now require Meson 0.53 or later, so we can use this feature introduced in 0.51. This also fixes a build failure on SUSE Leap 15.6.

@Luca
The patch lgtm, but could you develop on what was wrong with SUSE?

Quoted 1 line

@Kevin.
Just a note, this patch is probably not relevant to 21.11 as the switch to meson 0.53.2 was done in 22.11.

Quoted 2 lines
Signature · 1 line
David Marchand
#5 lore raw
Quoted 11 lines · David Marchand
Quoted 5 lines · On Sun, Jun 23, 2024 at 2:30 PM <[email protected]> wrote:

From: Luca Boccassi <[email protected]>

We now require Meson 0.53 or later, so we can use this feature introduced in 0.51. This also fixes a build failure on SUSE Leap 15.6.

@Luca
The patch lgtm, but could you develop on what was wrong with SUSE?

Quoted 6 lines
Quoted 1 line

@Kevin.
Just a note, this patch is probably not relevant to 21.11 as the switch to meson 0.53.2 was done in 22.11.

Ack. thanks for letting me know.

Quoted 4 lines
Quoted 2 lines
#6 lore raw
In reply to David Marchand
Quoted 10 lines · David Marchand
Quoted 5 lines · On Sun, Jun 23, 2024 at 2:30 PM <[email protected]> wrote:

From: Luca Boccassi <[email protected]>

We now require Meson 0.53 or later, so we can use this feature introduced in 0.51. This also fixes a build failure on SUSE Leap 15.6.

@Luca
The patch lgtm, but could you develop on what was wrong with SUSE?

The separate manual check is causing it to pick a different non-default python3 version, which doesn't have elftools installed, which breaks the meson run:

https://build.opensuse.org/package/live_build_log/home:bluca:dpdk/dpdk/openSUSE_Leap_15.6/x86_64