DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH] build: error out when missing elftools python module
Date: Fri, 27 Jun 2025 15:27:59 +0000	[thread overview]
Message-ID: <20250627152759.145084-1-bruce.richardson@intel.com> (raw)

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@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


                 reply	other threads:[~2025-06-27 15:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250627152759.145084-1-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).