From patchwork Thu May 1 14:12:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 23328 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 16A09BE08B for ; Thu, 1 May 2025 14:12:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C4BDB68AD5; Thu, 1 May 2025 16:12:55 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="dXodiDPA"; 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 B85A768AD0 for ; Thu, 1 May 2025 16:12:53 +0200 (CEST) Received: from pb-laptop.local (185.221.143.50.nat.pool.zt.hu [185.221.143.50]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A235663D for ; Thu, 1 May 2025 16:12:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1746108766; bh=xJKQKDkmfuNk0Dh8VpRB74ptaZLxVCoaCHlhFrgUtIU=; h=From:To:Subject:Date:From; b=dXodiDPA6DxXyHQIb8tIIjBP78DlPVDYZfqMAR+g7C+iGQb2SgW0jTM7f2Z0prMEv IhX+vaSXVry7NURPCIZtzEVzGm1PJ1K1qPA6VmXva12kDRIgrdOji2dwwSiC7ev5FN zpEl9ubAQl/2c5tz1s32EWmuGf3yXmCq8O8z9HPM= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1] py: Set `PYTHONPATH` in devenv Date: Thu, 1 May 2025 16:12:50 +0200 Message-ID: <20250501141250.4140986-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.49.0 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" If the python bindings are built, then set the `PYTHONPATH` environmental variable in the meson devenv accordingly to make it easy to use. $ meson devenv -C build [libcamera] $ echo $PYTHONPATH /libcamera/build/src/py [libcamera] $ python Python 3.13.3 (main, Apr 9 2025, 07:44:25) [GCC 14.2.1 20250207] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import libcamera >>> cm = libcamera.CameraManager.singleton() [...] [129:52:33.293860558] [4133380] INFO Camera camera_manager.cpp:326 libcamera v0.5.0+169-7dbe74b5-dirty (2025-05-01) [...] Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham --- src/py/libcamera/meson.build | 16 ---------------- src/py/meson.build | 12 ++++++++++++ 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build index 456ee7932..33ab65798 100644 --- a/src/py/libcamera/meson.build +++ b/src/py/libcamera/meson.build @@ -1,21 +1,5 @@ # SPDX-License-Identifier: CC0-1.0 -py3_dep = dependency('python3', required : get_option('pycamera')) - -if not py3_dep.found() - pycamera_enabled = false - subdir_done() -endif - -pybind11_dep = dependency('pybind11', required : get_option('pycamera')) - -if not pybind11_dep.found() - pycamera_enabled = false - subdir_done() -endif - -pycamera_enabled = true - pycamera_sources = files([ 'py_camera_manager.cpp', 'py_color_space.cpp', diff --git a/src/py/meson.build b/src/py/meson.build index a4586b4ae..922806971 100644 --- a/src/py/meson.build +++ b/src/py/meson.build @@ -1,3 +1,15 @@ # SPDX-License-Identifier: CC0-1.0 +py3_dep = dependency('python3', required : get_option('pycamera')) +pybind11_dep = dependency('pybind11', required : get_option('pycamera')) + +pycamera_enabled = py3_dep.found() and pybind11_dep.found() +if not pycamera_enabled + subdir_done() +endif + subdir('libcamera') + +pycamera_devenv = environment() +pycamera_devenv.prepend('PYTHONPATH', meson.current_build_dir()) +meson.add_devenv(pycamera_devenv)