From 54aeb0447c5ecee52f7e880d1977f566f741db09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Thu, 1 May 2025 15:35:57 +0200 Subject: py: Set `PYTHONPATH` in devenv MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Paul Elder --- src/py/libcamera/meson.build | 16 ---------------- src/py/meson.build | 12 ++++++++++++ 2 files changed, 12 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build index 596a203c..0b38b124 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 a4586b4a..92280697 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) -- cgit v1.2.1