[libcamera-devel] [PATCH v2 02/13] py: meson: add pystubs build target

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed May 18 12:49:03 CEST 2022


Hi Tomi,

On Wed, May 18, 2022 at 09:43:45AM +0300, Tomi Valkeinen wrote:
> On 17/05/2022 19:21, Kieran Bingham wrote:
> > Quoting Tomi Valkeinen (2022-05-17 15:33:14)
> >> Add a 'pystubs' build target for building the python stubs.
> >>
> >> For now this needs to be ran manually. I didn't figure out how to
> >> generate the stubs after the libcamera bindings are built.
> >>
> >> Signed-off-by: Tomi Valkeinen <tomi.valkeinen at ideasonboard.com>
> > 
> > Hrm ... It sounds like this wants to be some sort of post-build step.
> > 
> > Searching quickly seems to find only things like:
> >    https://github.com/mesonbuild/meson/issues/2957
> > 
> > Which seems to suggest a custom target (which is the full target, to
> > build pycamera, and the stubs?) and have it depend on the pycamera
> > shared_module().
> > 
> > But I'm not sure if that's a full understanding of what you're trying to
> > achieve here.
> > 
> > Anyway, having a target is better than expecting a user to execute a
> > manual command successfully - (but I fear at the moment, this won't get
> > used directly?)
> 
> I think custom_target doesn't work, as this can only be built when doing 
> a native build. You have to be able to use the produced bindings module 
> to be able to run stubgen.

We could possibly disable it for cross-builds, using
meson.is_cross_build() or meson.can_run_host_binaries() (see
https://mesonbuild.com/Cross-compilation.html#introspection-and-system-checks).

> I expect that the stubs would eventually be something that are committed 
> to the repository, and updated when needed.
> 
> As we also have the meson 0.57 requirement... Maybe I'll just leave this 
> out for now.

That's fine with me.

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list