[libcamera-devel] py: Honour the pycamera meson option
diff mbox series

Message ID 20220623124140.610241-1-javierm@redhat.com
State Rejected
Headers show
Series
  • [libcamera-devel] py: Honour the pycamera meson option
Related show

Commit Message

Javier Martinez Canillas June 23, 2022, 12:41 p.m. UTC
The libcamera Python bindings are attempted to be built unconditionally,
even when there is a meson feature option to disable it. Make the meson
build file in the sub-dir to exit earlier if pycamera has been disabled.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---

 src/py/libcamera/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kieran Bingham June 23, 2022, 4:25 p.m. UTC | #1
Quoting Javier Martinez Canillas (2022-06-23 13:41:40)
> The libcamera Python bindings are attempted to be built unconditionally,
> even when there is a meson feature option to disable it. Make the meson
> build file in the sub-dir to exit earlier if pycamera has been disabled.
> 

s/ to exit/ exit/

Seems reasonable, I wonder if there are other components that don't
adhere to the disabled option too, as I expect the dep.found() pattern
is used elsewhere. And the 'disabled' only makes it optional to find it
(which it still can).

Any interest in checking other uses to go along side this? (Probably as
one patch) - otherwise, merging this if agreed should still be a
resolution to the current issue.

--

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
> 
>  src/py/libcamera/meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build
> index eb8845388692..5efae1baec8c 100644
> --- a/src/py/libcamera/meson.build
> +++ b/src/py/libcamera/meson.build
> @@ -2,7 +2,7 @@
>  
>  py3_dep = dependency('python3', required : get_option('pycamera'))
>  
> -if not py3_dep.found()
> +if get_option('pycamera').disabled() or not py3_dep.found()
>      pycamera_enabled = false
>      subdir_done()
>  endif
> -- 
> 2.36.1
>
Laurent Pinchart June 23, 2022, 5:06 p.m. UTC | #2
Hello,

On Thu, Jun 23, 2022 at 05:25:56PM +0100, Kieran Bingham wrote:
> Quoting Javier Martinez Canillas (2022-06-23 13:41:40)
> > The libcamera Python bindings are attempted to be built unconditionally,
> > even when there is a meson feature option to disable it. Make the meson
> > build file in the sub-dir to exit earlier if pycamera has been disabled.
> 
> s/ to exit/ exit/
> 
> Seems reasonable, I wonder if there are other components that don't
> adhere to the disabled option too, as I expect the dep.found() pattern
> is used elsewhere. And the 'disabled' only makes it optional to find it
> (which it still can).
> 
> Any interest in checking other uses to go along side this? (Probably as
> one patch) - otherwise, merging this if agreed should still be a
> resolution to the current issue.

https://mesonbuild.com/Build-options.html#features

"disabled do not look for the dependency and always return 'not-found'."

I've just tested it, and I confirm the behaviour. If I set pycamera to
disabled, then it doesn't get built, even if the dependency exists.

> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> > Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> > ---
> > 
> >  src/py/libcamera/meson.build | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build
> > index eb8845388692..5efae1baec8c 100644
> > --- a/src/py/libcamera/meson.build
> > +++ b/src/py/libcamera/meson.build
> > @@ -2,7 +2,7 @@
> >  
> >  py3_dep = dependency('python3', required : get_option('pycamera'))
> >  
> > -if not py3_dep.found()
> > +if get_option('pycamera').disabled() or not py3_dep.found()
> >      pycamera_enabled = false
> >      subdir_done()
> >  endif
Javier Martinez Canillas June 23, 2022, 11:17 p.m. UTC | #3
Hello Laurent,

On 6/23/22 19:06, Laurent Pinchart wrote:
> Hello,
> 
> On Thu, Jun 23, 2022 at 05:25:56PM +0100, Kieran Bingham wrote:
>> Quoting Javier Martinez Canillas (2022-06-23 13:41:40)
>>> The libcamera Python bindings are attempted to be built unconditionally,
>>> even when there is a meson feature option to disable it. Make the meson
>>> build file in the sub-dir to exit earlier if pycamera has been disabled.
>>
>> s/ to exit/ exit/
>>
>> Seems reasonable, I wonder if there are other components that don't
>> adhere to the disabled option too, as I expect the dep.found() pattern
>> is used elsewhere. And the 'disabled' only makes it optional to find it
>> (which it still can).
>>
>> Any interest in checking other uses to go along side this? (Probably as
>> one patch) - otherwise, merging this if agreed should still be a
>> resolution to the current issue.
> 
> https://mesonbuild.com/Build-options.html#features
> 
> "disabled do not look for the dependency and always return 'not-found'."
> 
> I've just tested it, and I confirm the behaviour. If I set pycamera to
> disabled, then it doesn't get built, even if the dependency exists.
> 
You are right. I just tested dropping this patch from the package and it
does indeed still build. I wonder why it failed for me before that lead
me to write this patch. Maybe I did something silly when testing my pkg
build...

Feel free to discard this patch, sorry to the noise.

Patch
diff mbox series

diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build
index eb8845388692..5efae1baec8c 100644
--- a/src/py/libcamera/meson.build
+++ b/src/py/libcamera/meson.build
@@ -2,7 +2,7 @@ 
 
 py3_dep = dependency('python3', required : get_option('pycamera'))
 
-if not py3_dep.found()
+if get_option('pycamera').disabled() or not py3_dep.found()
     pycamera_enabled = false
     subdir_done()
 endif