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

Tomi Valkeinen tomi.valkeinen at ideasonboard.com
Thu Aug 11 16:11:07 CEST 2022


On 11/08/2022 13:54, Martin Kletzander via libcamera-devel wrote:
> 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,

There was a similar patch posted some time back:

https://lists.libcamera.org/pipermail/libcamera-devel/2022-May/030423.html

This doesn't work when cross-compiling.

  Tomi


More information about the libcamera-devel mailing list