[libcamera-devel] [PATCH 2/2] meson: Define python3 and python3-yaml required dependencies
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Nov 18 20:01:41 CET 2019
Hi Ezequiel,
On Mon, Nov 18, 2019 at 08:54:43PM +0200, Laurent Pinchart wrote:
> On Mon, Nov 18, 2019 at 09:14:10AM -0300, Ezequiel Garcia wrote:
> > On Mon, 2019-11-18 at 02:26 +0200, Laurent Pinchart wrote:
> >> On Fri, Nov 15, 2019 at 12:23:42PM -0300, Ezequiel Garcia wrote:
> >>> With this change, meson will complain specifically about missing
> >>> python3 and missing python3-yaml. As specified by meson
> >>> documentation: https://mesonbuild.com/Python-module.html,
> >>> this change requires meson v0.51.
> >
> > How about this
> >
> > +# meson v0.51 is too new and not distributed
> > +# by major distros. Let's take advantage of it
> > +# optionally.
> > +if meson.version().version_compare('>=0.51')
> > + py_mod = import('python')
> > + py_inst = py_mod.find_installation('python3', modules: ['yaml'])
>
> Do you need to assign the return value to a variable ?
>
> > +endif
> > +
> >
> > ?
> >
> > Just to get the thing documented, we can drop the ifs
> > once libcamera requires meson 0.51
>
> That looks better to me, but should be conditioned to the documentation
> option being enabled.
Scratch this, I got it mixed in my head. This is unrelated to
documentation. Your proposal looks good. We may want to already prepare
for additional modules with something along the lines of
/meson.build:
# Towards the beginning
py_modules = []
...
# Towards the end
if meson.version().version_compare('>=0.51')
py_mod = import('python')
py_mod.find_installation('python3', modules: py_modules)
endif
/src/libcamera/meson.build:
...
py_modules += ['yaml']
...
but that could also be done later.
> >> Neither Debian stable nor Ubuntu stable ship meson v0.51 or newer, so I
> >> think this is a too strict requirement. There are useful features in
> >> newer meson verions, but we want to keep libcamera easily buildable on
> >> common distributions.
> >>
> >>> Signed-off-by: Ezequiel Garcia <ezequiel at collabora.com>
> >>> ---
> >>> meson.build | 2 +-
> >>> src/libcamera/meson.build | 3 +++
> >>> 2 files changed, 4 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/meson.build b/meson.build
> >>> index 72ad7c8b493b..38c0f1d55b56 100644
> >>> --- a/meson.build
> >>> +++ b/meson.build
> >>> @@ -1,5 +1,5 @@
> >>> project('libcamera', 'c', 'cpp',
> >>> - meson_version : '>= 0.40',
> >>> + meson_version : '>= 0.51',
> >>> version : '0.0.0',
> >>> default_options : [
> >>> 'werror=true',
> >>> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
> >>> index afbca76968f9..509499359cdb 100644
> >>> --- a/src/libcamera/meson.build
> >>> +++ b/src/libcamera/meson.build
> >>> @@ -61,6 +61,9 @@ if libudev.found()
> >>> ])
> >>> endif
> >>>
> >>> +py_mod = import('python')
> >>> +py_inst = py_mod.find_installation('python3', modules: ['yaml'])
> >>> +
> >>> gen_controls = files('gen-controls.py')
> >>>
> >>> control_ids_cpp = custom_target('control_ids_cpp',
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list