[libcamera-devel] py: Fix gen-py-control-enums.py reference
diff mbox series

Message ID 20220510152107.610191-1-kieran.bingham@ideasonboard.com
State Accepted
Commit 226563607ea888c0af49bf3cdc7b3654d6a50089
Headers show
Series
  • [libcamera-devel] py: Fix gen-py-control-enums.py reference
Related show

Commit Message

Kieran Bingham May 10, 2022, 3:21 p.m. UTC
Scripts should be referenced using the meson files() directive to ensure
the location is correctly identified with the relevant paths. This
prevents compilation failures if the working directory does not match
the source tree.

Fixes: 6e92cb9dc49e ("py: Generate control enums from yaml")
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
It seems in my testing, that this occurs on meson 57 and below, but
wasn't reproduced on meson 58. This fixes the issue anyway, and ensures
we are consistent in our usage of scripts internally.
---
 src/py/libcamera/meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Laurent Pinchart May 10, 2022, 3:36 p.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Tue, May 10, 2022 at 05:21:07PM +0200, Kieran Bingham via libcamera-devel wrote:
> Scripts should be referenced using the meson files() directive to ensure
> the location is correctly identified with the relevant paths. This
> prevents compilation failures if the working directory does not match
> the source tree.
> 
> Fixes: 6e92cb9dc49e ("py: Generate control enums from yaml")
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
> It seems in my testing, that this occurs on meson 57 and below, but
> wasn't reproduced on meson 58. This fixes the issue anyway, and ensures
> we are consistent in our usage of scripts internally.
> ---

Looks good to me,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

I would still like to see a patch to use files() for gen_input_files
too. I understand that Tomi is on it.

>  src/py/libcamera/meson.build | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build
> index 842db1ed3ddd..0cd7c75bb86c 100644
> --- a/src/py/libcamera/meson.build
> +++ b/src/py/libcamera/meson.build
> @@ -22,10 +22,12 @@ gen_input_files = [
>      'pyenums_generated.cpp.in',
>  ]
>  
> +gen_py_control_enums = files('gen-py-control-enums.py')
> +
>  generated_sources = custom_target('py_gen_controls',
>                                    input : gen_input_files,
>                                    output : ['pyenums_generated.cpp'],
> -                                  command : ['gen-py-control-enums.py', '-o', '@OUTPUT@', '@INPUT@'])
> +                                  command : [gen_py_control_enums, '-o', '@OUTPUT@', '@INPUT@'])
>  
>  pycamera_sources += generated_sources
Umang Jain May 10, 2022, 3:45 p.m. UTC | #2
Hi Kieran,

Thanks for the patch,

On 5/10/22 20:51, Kieran Bingham via libcamera-devel wrote:
> Scripts should be referenced using the meson files() directive to ensure
> the location is correctly identified with the relevant paths. This
> prevents compilation failures if the working directory does not match
> the source tree.
>
> Fixes: 6e92cb9dc49e ("py: Generate control enums from yaml")
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>


Makes sense,

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

> ---
> It seems in my testing, that this occurs on meson 57 and below, but
> wasn't reproduced on meson 58. This fixes the issue anyway, and ensures
> we are consistent in our usage of scripts internally.
> ---
>   src/py/libcamera/meson.build | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build
> index 842db1ed3ddd..0cd7c75bb86c 100644
> --- a/src/py/libcamera/meson.build
> +++ b/src/py/libcamera/meson.build
> @@ -22,10 +22,12 @@ gen_input_files = [
>       'pyenums_generated.cpp.in',
>   ]
>   
> +gen_py_control_enums = files('gen-py-control-enums.py')
> +
>   generated_sources = custom_target('py_gen_controls',
>                                     input : gen_input_files,
>                                     output : ['pyenums_generated.cpp'],
> -                                  command : ['gen-py-control-enums.py', '-o', '@OUTPUT@', '@INPUT@'])
> +                                  command : [gen_py_control_enums, '-o', '@OUTPUT@', '@INPUT@'])
>   
>   pycamera_sources += generated_sources
>
Tomi Valkeinen May 10, 2022, 4:02 p.m. UTC | #3
On 10/05/2022 18:21, Kieran Bingham wrote:
> Scripts should be referenced using the meson files() directive to ensure
> the location is correctly identified with the relevant paths. This
> prevents compilation failures if the working directory does not match
> the source tree.
> 
> Fixes: 6e92cb9dc49e ("py: Generate control enums from yaml")
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
> It seems in my testing, that this occurs on meson 57 and below, but
> wasn't reproduced on meson 58. This fixes the issue anyway, and ensures
> we are consistent in our usage of scripts internally.
> ---
>   src/py/libcamera/meson.build | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build
> index 842db1ed3ddd..0cd7c75bb86c 100644
> --- a/src/py/libcamera/meson.build
> +++ b/src/py/libcamera/meson.build
> @@ -22,10 +22,12 @@ gen_input_files = [
>       'pyenums_generated.cpp.in',
>   ]
>   
> +gen_py_control_enums = files('gen-py-control-enums.py')
> +
>   generated_sources = custom_target('py_gen_controls',
>                                     input : gen_input_files,
>                                     output : ['pyenums_generated.cpp'],
> -                                  command : ['gen-py-control-enums.py', '-o', '@OUTPUT@', '@INPUT@'])
> +                                  command : [gen_py_control_enums, '-o', '@OUTPUT@', '@INPUT@'])
>   
>   pycamera_sources += generated_sources
>   

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

  Tomi

Patch
diff mbox series

diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build
index 842db1ed3ddd..0cd7c75bb86c 100644
--- a/src/py/libcamera/meson.build
+++ b/src/py/libcamera/meson.build
@@ -22,10 +22,12 @@  gen_input_files = [
     'pyenums_generated.cpp.in',
 ]
 
+gen_py_control_enums = files('gen-py-control-enums.py')
+
 generated_sources = custom_target('py_gen_controls',
                                   input : gen_input_files,
                                   output : ['pyenums_generated.cpp'],
-                                  command : ['gen-py-control-enums.py', '-o', '@OUTPUT@', '@INPUT@'])
+                                  command : [gen_py_control_enums, '-o', '@OUTPUT@', '@INPUT@'])
 
 pycamera_sources += generated_sources