From patchwork Mon Aug 18 12:11:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 24156 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 7512DBDCC1 for ; Mon, 18 Aug 2025 12:11:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1F27C6925A; Mon, 18 Aug 2025 14:11:32 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="LQZXgEia"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0039C69263 for ; Mon, 18 Aug 2025 14:11:29 +0200 (CEST) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 9F2CB1249 for ; Mon, 18 Aug 2025 14:10:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1755519032; bh=CXmF1R+gh+w+tZyqtht9BK1JPDHkaAw2b4ypkfPxpho=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LQZXgEiaTVffC1MfXchFx8+slgMQ435MJ04aAL13BmRyqlRx2yjwdKsu51r71rsuy NOx7Sc0G3JF8wi3LmO4ra478Lg5kuy5siti3Du/1naXqKFamfTosLPMAp7zWt5Hx0i W0F9E2xPcl9Pcmu/310vZaChZ72LBWtbisU5N3CE= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH 2/2] meson: Check for Python modules manually Date: Mon, 18 Aug 2025 15:11:03 +0300 Message-ID: <20250818121103.20073-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.49.1 In-Reply-To: <20250818121103.20073-1-laurent.pinchart@ideasonboard.com> References: <20250818121103.20073-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The meson python module's find_installation() method conveniently allows testing if the interpreter provides a set of modules. We use it to check for the presence of the modules required at build time. Unfortunately, the meson python module is not meant to access the native Python interpreter of the build machine, but the Python environment of the host machine. Usage of find_installation() for this purpose is incorrect, it may find modules in a different interpreter than the one used to run the build scripts that use those modules. Replace find_installation() with a manual check using python3 directly. Signed-off-by: Laurent Pinchart Reviewed-by: Tomi Valkeinen --- meson.build | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index d82dbaeb99ce..5e015692a22c 100644 --- a/meson.build +++ b/meson.build @@ -287,9 +287,14 @@ run_command('ln', '-fsT', meson.project_source_root(), meson.project_build_root( configure_file(output : 'config.h', configuration : config_h) -# Check for python installation and modules. -py_mod = import('python') -py_mod.find_installation('python3', modules : py_modules) +# Check for python modules. +foreach module : py_modules + result = run_command('python3', '-c' , 'import @0@'.format(module), + capture : false, check : false) + if result.returncode() != 0 + error('Python module \'@0@\' not found'.format(module)) + endif +endforeach ## Summarise Configurations summary({