[libcamera-devel] [PATCH] build: Fix python dependency

Martin Kletzander nert.pinx at gmail.com
Thu Aug 11 12:54:59 CEST 2022


Building with pycamera fails due to dependency search for 'python3'.  Fix that
by using meson's python module which searches for the proper files and various
versions.

Signed-off-by: Martin Kletzander <nert.pinx at gmail.com>
---
 src/py/libcamera/meson.build | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build
index eb8845388692..cf2e9395de38 100644
--- a/src/py/libcamera/meson.build
+++ b/src/py/libcamera/meson.build
@@ -1,8 +1,9 @@
 # SPDX-License-Identifier: CC0-1.0
 
-py3_dep = dependency('python3', required : get_option('pycamera'))
+pymod = import('python')
+py3 = pymod.find_installation('python3', required : get_option('pycamera'))
 
-if not py3_dep.found()
+if not py3.found()
     pycamera_enabled = false
     subdir_done()
 endif
@@ -60,7 +61,7 @@ pycamera_sources += custom_target('py_gen_formats',
 
 pycamera_deps = [
     libcamera_public,
-    py3_dep,
+    py3.dependency(),
     pybind11_dep,
 ]
 
@@ -71,7 +72,7 @@ pycamera_args = [
     '-DLIBCAMERA_BASE_PRIVATE',
 ]
 
-destdir = get_option('libdir') / ('python' + py3_dep.version()) / 'site-packages' / 'libcamera'
+destdir = get_option('libdir') / ('python' + py3.language_version()) / 'site-packages' / 'libcamera'
 
 pycamera = shared_module('_libcamera',
                          pycamera_sources,
-- 
2.35.1



More information about the libcamera-devel mailing list