[libcamera-devel,v3,16/18] py: clean up control enums generation
diff mbox series

Message ID 20220518131329.66994-17-tomi.valkeinen@ideasonboard.com
State Accepted
Headers show
Series
  • Misc Python bindings patches
Related show

Commit Message

Tomi Valkeinen May 18, 2022, 1:13 p.m. UTC
Try to be more consistent with the names, and include "control" in all
the names.

Also drop a useless "using namespace libcamera" and only include
"control_ids.h".

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 src/py/libcamera/meson.build                         | 12 +++++-------
 ...ated.cpp.in => py_control_enums_generated.cpp.in} |  8 +++-----
 src/py/libcamera/py_main.cpp                         |  4 ++--
 3 files changed, 10 insertions(+), 14 deletions(-)
 rename src/py/libcamera/{py_enums_generated.cpp.in => py_control_enums_generated.cpp.in} (63%)

Comments

Laurent Pinchart May 18, 2022, 1:44 p.m. UTC | #1
Hi Tomi,

Thank you for the patch.

On Wed, May 18, 2022 at 04:13:27PM +0300, Tomi Valkeinen wrote:
> Try to be more consistent with the names, and include "control" in all
> the names.
> 
> Also drop a useless "using namespace libcamera" and only include
> "control_ids.h".
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

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

> ---
>  src/py/libcamera/meson.build                         | 12 +++++-------
>  ...ated.cpp.in => py_control_enums_generated.cpp.in} |  8 +++-----
>  src/py/libcamera/py_main.cpp                         |  4 ++--
>  3 files changed, 10 insertions(+), 14 deletions(-)
>  rename src/py/libcamera/{py_enums_generated.cpp.in => py_control_enums_generated.cpp.in} (63%)
> 
> diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build
> index 55957252..a3388c63 100644
> --- a/src/py/libcamera/meson.build
> +++ b/src/py/libcamera/meson.build
> @@ -18,20 +18,18 @@ pycamera_sources = files([
>      'py_main.cpp',
>  ])
>  
> -gen_input_files = files([
> +gen_py_control_enums_input_files = files([
>      '../../libcamera/control_ids.yaml',
> -    'py_enums_generated.cpp.in',
> +    'py_control_enums_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 : ['py_enums_generated.cpp'],
> +pycamera_sources += custom_target('py_gen_controls',
> +                                  input : gen_py_control_enums_input_files,
> +                                  output : ['py_control_enums_generated.cpp'],
>                                    command : [gen_py_control_enums, '-o', '@OUTPUT@', '@INPUT@'])
>  
> -pycamera_sources += generated_sources
> -
>  pycamera_deps = [
>      libcamera_public,
>      py3_dep,
> diff --git a/src/py/libcamera/py_enums_generated.cpp.in b/src/py/libcamera/py_control_enums_generated.cpp.in
> similarity index 63%
> rename from src/py/libcamera/py_enums_generated.cpp.in
> rename to src/py/libcamera/py_control_enums_generated.cpp.in
> index 20e07528..ed81fbe7 100644
> --- a/src/py/libcamera/py_enums_generated.cpp.in
> +++ b/src/py/libcamera/py_control_enums_generated.cpp.in
> @@ -2,20 +2,18 @@
>  /*
>   * Copyright (C) 2022, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
>   *
> - * Python bindings - Auto-generated enums
> + * Python bindings - Auto-generated control enums
>   *
>   * This file is auto-generated. Do not edit.
>   */
>  
> -#include <libcamera/libcamera.h>
> +#include <libcamera/control_ids.h>
>  
>  #include <pybind11/smart_holder.h>
>  
>  namespace py = pybind11;
>  
> -using namespace libcamera;
> -
> -void init_py_enums_generated(py::module& m)
> +void init_py_control_enums_generated(py::module& m)
>  {
>  ${enums}
>  }
> diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
> index b05bbb22..1d941160 100644
> --- a/src/py/libcamera/py_main.cpp
> +++ b/src/py/libcamera/py_main.cpp
> @@ -131,13 +131,13 @@ static void handleRequestCompleted(Request *req)
>  }
>  
>  void init_py_enums(py::module &m);
> -void init_py_enums_generated(py::module &m);
> +void init_py_control_enums_generated(py::module &m);
>  void init_py_geometry(py::module &m);
>  
>  PYBIND11_MODULE(_libcamera, m)
>  {
>  	init_py_enums(m);
> -	init_py_enums_generated(m);
> +	init_py_control_enums_generated(m);
>  	init_py_geometry(m);
>  
>  	/* Forward declarations */
Kieran Bingham May 18, 2022, 2:10 p.m. UTC | #2
Quoting Laurent Pinchart (2022-05-18 14:44:24)
> Hi Tomi,
> 
> Thank you for the patch.
> 
> On Wed, May 18, 2022 at 04:13:27PM +0300, Tomi Valkeinen wrote:
> > Try to be more consistent with the names, and include "control" in all
> > the names.
> > 
> > Also drop a useless "using namespace libcamera" and only include
> > "control_ids.h".
> > 
> > Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

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

> 
> > ---
> >  src/py/libcamera/meson.build                         | 12 +++++-------
> >  ...ated.cpp.in => py_control_enums_generated.cpp.in} |  8 +++-----
> >  src/py/libcamera/py_main.cpp                         |  4 ++--
> >  3 files changed, 10 insertions(+), 14 deletions(-)
> >  rename src/py/libcamera/{py_enums_generated.cpp.in => py_control_enums_generated.cpp.in} (63%)
> > 
> > diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build
> > index 55957252..a3388c63 100644
> > --- a/src/py/libcamera/meson.build
> > +++ b/src/py/libcamera/meson.build
> > @@ -18,20 +18,18 @@ pycamera_sources = files([
> >      'py_main.cpp',
> >  ])
> >  
> > -gen_input_files = files([
> > +gen_py_control_enums_input_files = files([
> >      '../../libcamera/control_ids.yaml',
> > -    'py_enums_generated.cpp.in',
> > +    'py_control_enums_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 : ['py_enums_generated.cpp'],
> > +pycamera_sources += custom_target('py_gen_controls',
> > +                                  input : gen_py_control_enums_input_files,
> > +                                  output : ['py_control_enums_generated.cpp'],
> >                                    command : [gen_py_control_enums, '-o', '@OUTPUT@', '@INPUT@'])
> >  
> > -pycamera_sources += generated_sources
> > -
> >  pycamera_deps = [
> >      libcamera_public,
> >      py3_dep,
> > diff --git a/src/py/libcamera/py_enums_generated.cpp.in b/src/py/libcamera/py_control_enums_generated.cpp.in
> > similarity index 63%
> > rename from src/py/libcamera/py_enums_generated.cpp.in
> > rename to src/py/libcamera/py_control_enums_generated.cpp.in
> > index 20e07528..ed81fbe7 100644
> > --- a/src/py/libcamera/py_enums_generated.cpp.in
> > +++ b/src/py/libcamera/py_control_enums_generated.cpp.in
> > @@ -2,20 +2,18 @@
> >  /*
> >   * Copyright (C) 2022, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> >   *
> > - * Python bindings - Auto-generated enums
> > + * Python bindings - Auto-generated control enums
> >   *
> >   * This file is auto-generated. Do not edit.
> >   */
> >  
> > -#include <libcamera/libcamera.h>
> > +#include <libcamera/control_ids.h>
> >  
> >  #include <pybind11/smart_holder.h>
> >  
> >  namespace py = pybind11;
> >  
> > -using namespace libcamera;
> > -
> > -void init_py_enums_generated(py::module& m)
> > +void init_py_control_enums_generated(py::module& m)
> >  {
> >  ${enums}
> >  }
> > diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
> > index b05bbb22..1d941160 100644
> > --- a/src/py/libcamera/py_main.cpp
> > +++ b/src/py/libcamera/py_main.cpp
> > @@ -131,13 +131,13 @@ static void handleRequestCompleted(Request *req)
> >  }
> >  
> >  void init_py_enums(py::module &m);
> > -void init_py_enums_generated(py::module &m);
> > +void init_py_control_enums_generated(py::module &m);
> >  void init_py_geometry(py::module &m);
> >  
> >  PYBIND11_MODULE(_libcamera, m)
> >  {
> >       init_py_enums(m);
> > -     init_py_enums_generated(m);
> > +     init_py_control_enums_generated(m);
> >       init_py_geometry(m);
> >  
> >       /* Forward declarations */
> 
> -- 
> Regards,
> 
> Laurent Pinchart

Patch
diff mbox series

diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build
index 55957252..a3388c63 100644
--- a/src/py/libcamera/meson.build
+++ b/src/py/libcamera/meson.build
@@ -18,20 +18,18 @@  pycamera_sources = files([
     'py_main.cpp',
 ])
 
-gen_input_files = files([
+gen_py_control_enums_input_files = files([
     '../../libcamera/control_ids.yaml',
-    'py_enums_generated.cpp.in',
+    'py_control_enums_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 : ['py_enums_generated.cpp'],
+pycamera_sources += custom_target('py_gen_controls',
+                                  input : gen_py_control_enums_input_files,
+                                  output : ['py_control_enums_generated.cpp'],
                                   command : [gen_py_control_enums, '-o', '@OUTPUT@', '@INPUT@'])
 
-pycamera_sources += generated_sources
-
 pycamera_deps = [
     libcamera_public,
     py3_dep,
diff --git a/src/py/libcamera/py_enums_generated.cpp.in b/src/py/libcamera/py_control_enums_generated.cpp.in
similarity index 63%
rename from src/py/libcamera/py_enums_generated.cpp.in
rename to src/py/libcamera/py_control_enums_generated.cpp.in
index 20e07528..ed81fbe7 100644
--- a/src/py/libcamera/py_enums_generated.cpp.in
+++ b/src/py/libcamera/py_control_enums_generated.cpp.in
@@ -2,20 +2,18 @@ 
 /*
  * Copyright (C) 2022, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
  *
- * Python bindings - Auto-generated enums
+ * Python bindings - Auto-generated control enums
  *
  * This file is auto-generated. Do not edit.
  */
 
-#include <libcamera/libcamera.h>
+#include <libcamera/control_ids.h>
 
 #include <pybind11/smart_holder.h>
 
 namespace py = pybind11;
 
-using namespace libcamera;
-
-void init_py_enums_generated(py::module& m)
+void init_py_control_enums_generated(py::module& m)
 {
 ${enums}
 }
diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
index b05bbb22..1d941160 100644
--- a/src/py/libcamera/py_main.cpp
+++ b/src/py/libcamera/py_main.cpp
@@ -131,13 +131,13 @@  static void handleRequestCompleted(Request *req)
 }
 
 void init_py_enums(py::module &m);
-void init_py_enums_generated(py::module &m);
+void init_py_control_enums_generated(py::module &m);
 void init_py_geometry(py::module &m);
 
 PYBIND11_MODULE(_libcamera, m)
 {
 	init_py_enums(m);
-	init_py_enums_generated(m);
+	init_py_control_enums_generated(m);
 	init_py_geometry(m);
 
 	/* Forward declarations */