[libcamera-devel,v3,15/18] py: rename pyxyz to py_xyz
diff mbox series

Message ID 20220518131329.66994-16-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
Having the underscore makes the names more readable, especially when
there are multiple words in the name.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 src/py/libcamera/meson.build                         | 10 +++++-----
 src/py/libcamera/{pyenums.cpp => py_enums.cpp}       |  2 +-
 ...ms_generated.cpp.in => py_enums_generated.cpp.in} |  2 +-
 src/py/libcamera/{pygeometry.cpp => py_geometry.cpp} |  2 +-
 src/py/libcamera/{pymain.cpp => py_main.cpp}         | 12 ++++++------
 5 files changed, 14 insertions(+), 14 deletions(-)
 rename src/py/libcamera/{pyenums.cpp => py_enums.cpp} (96%)
 rename src/py/libcamera/{pyenums_generated.cpp.in => py_enums_generated.cpp.in} (89%)
 rename src/py/libcamera/{pygeometry.cpp => py_geometry.cpp} (99%)
 rename src/py/libcamera/{pymain.cpp => py_main.cpp} (99%)

Comments

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

Thank you for the patch.

On Wed, May 18, 2022 at 04:13:26PM +0300, Tomi Valkeinen wrote:
> Having the underscore makes the names more readable, especially when
> there are multiple words in the name.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

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

> ---
>  src/py/libcamera/meson.build                         | 10 +++++-----
>  src/py/libcamera/{pyenums.cpp => py_enums.cpp}       |  2 +-
>  ...ms_generated.cpp.in => py_enums_generated.cpp.in} |  2 +-
>  src/py/libcamera/{pygeometry.cpp => py_geometry.cpp} |  2 +-
>  src/py/libcamera/{pymain.cpp => py_main.cpp}         | 12 ++++++------
>  5 files changed, 14 insertions(+), 14 deletions(-)
>  rename src/py/libcamera/{pyenums.cpp => py_enums.cpp} (96%)
>  rename src/py/libcamera/{pyenums_generated.cpp.in => py_enums_generated.cpp.in} (89%)
>  rename src/py/libcamera/{pygeometry.cpp => py_geometry.cpp} (99%)
>  rename src/py/libcamera/{pymain.cpp => py_main.cpp} (99%)
> 
> diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build
> index de66bb48..55957252 100644
> --- a/src/py/libcamera/meson.build
> +++ b/src/py/libcamera/meson.build
> @@ -13,21 +13,21 @@ pybind11_proj = subproject('pybind11')
>  pybind11_dep = pybind11_proj.get_variable('pybind11_dep')
>  
>  pycamera_sources = files([
> -    'pyenums.cpp',
> -    'pygeometry.cpp',
> -    'pymain.cpp',
> +    'py_enums.cpp',
> +    'py_geometry.cpp',
> +    'py_main.cpp',
>  ])
>  
>  gen_input_files = files([
>      '../../libcamera/control_ids.yaml',
> -    'pyenums_generated.cpp.in',
> +    'py_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 : ['pyenums_generated.cpp'],
> +                                  output : ['py_enums_generated.cpp'],
>                                    command : [gen_py_control_enums, '-o', '@OUTPUT@', '@INPUT@'])
>  
>  pycamera_sources += generated_sources
> diff --git a/src/py/libcamera/pyenums.cpp b/src/py/libcamera/py_enums.cpp
> similarity index 96%
> rename from src/py/libcamera/pyenums.cpp
> rename to src/py/libcamera/py_enums.cpp
> index b655e622..e55318f1 100644
> --- a/src/py/libcamera/pyenums.cpp
> +++ b/src/py/libcamera/py_enums.cpp
> @@ -13,7 +13,7 @@ namespace py = pybind11;
>  
>  using namespace libcamera;
>  
> -void init_pyenums(py::module &m)
> +void init_py_enums(py::module &m)
>  {
>  	py::enum_<StreamRole>(m, "StreamRole")
>  		.value("StillCapture", StreamRole::StillCapture)
> diff --git a/src/py/libcamera/pyenums_generated.cpp.in b/src/py/libcamera/py_enums_generated.cpp.in
> similarity index 89%
> rename from src/py/libcamera/pyenums_generated.cpp.in
> rename to src/py/libcamera/py_enums_generated.cpp.in
> index 6aaf4795..20e07528 100644
> --- a/src/py/libcamera/pyenums_generated.cpp.in
> +++ b/src/py/libcamera/py_enums_generated.cpp.in
> @@ -15,7 +15,7 @@ namespace py = pybind11;
>  
>  using namespace libcamera;
>  
> -void init_pyenums_generated(py::module& m)
> +void init_py_enums_generated(py::module& m)
>  {
>  ${enums}
>  }
> diff --git a/src/py/libcamera/pygeometry.cpp b/src/py/libcamera/py_geometry.cpp
> similarity index 99%
> rename from src/py/libcamera/pygeometry.cpp
> rename to src/py/libcamera/py_geometry.cpp
> index d77de144..84b0cb08 100644
> --- a/src/py/libcamera/pygeometry.cpp
> +++ b/src/py/libcamera/py_geometry.cpp
> @@ -18,7 +18,7 @@ namespace py = pybind11;
>  
>  using namespace libcamera;
>  
> -void init_pygeometry(py::module &m)
> +void init_py_geometry(py::module &m)
>  {
>  	auto pyPoint = py::class_<Point>(m, "Point");
>  	auto pySize = py::class_<Size>(m, "Size");
> diff --git a/src/py/libcamera/pymain.cpp b/src/py/libcamera/py_main.cpp
> similarity index 99%
> rename from src/py/libcamera/pymain.cpp
> rename to src/py/libcamera/py_main.cpp
> index ef3f157a..b05bbb22 100644
> --- a/src/py/libcamera/pymain.cpp
> +++ b/src/py/libcamera/py_main.cpp
> @@ -130,15 +130,15 @@ static void handleRequestCompleted(Request *req)
>  		LOG(Fatal) << "Unable to write to eventfd";
>  }
>  
> -void init_pyenums(py::module &m);
> -void init_pyenums_generated(py::module &m);
> -void init_pygeometry(py::module &m);
> +void init_py_enums(py::module &m);
> +void init_py_enums_generated(py::module &m);
> +void init_py_geometry(py::module &m);
>  
>  PYBIND11_MODULE(_libcamera, m)
>  {
> -	init_pyenums(m);
> -	init_pyenums_generated(m);
> -	init_pygeometry(m);
> +	init_py_enums(m);
> +	init_py_enums_generated(m);
> +	init_py_geometry(m);
>  
>  	/* Forward declarations */
>
Kieran Bingham May 18, 2022, 2:10 p.m. UTC | #2
Quoting Tomi Valkeinen (2022-05-18 14:13:26)
> Having the underscore makes the names more readable, especially when
> there are multiple words in the name.
> 

Fine with me, is this going to break users of pycamera already? I.e.
does picamera2 need a new rebase on top of this? If so - we should
highlight this to RPi.

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

> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> ---
>  src/py/libcamera/meson.build                         | 10 +++++-----
>  src/py/libcamera/{pyenums.cpp => py_enums.cpp}       |  2 +-
>  ...ms_generated.cpp.in => py_enums_generated.cpp.in} |  2 +-
>  src/py/libcamera/{pygeometry.cpp => py_geometry.cpp} |  2 +-
>  src/py/libcamera/{pymain.cpp => py_main.cpp}         | 12 ++++++------
>  5 files changed, 14 insertions(+), 14 deletions(-)
>  rename src/py/libcamera/{pyenums.cpp => py_enums.cpp} (96%)
>  rename src/py/libcamera/{pyenums_generated.cpp.in => py_enums_generated.cpp.in} (89%)
>  rename src/py/libcamera/{pygeometry.cpp => py_geometry.cpp} (99%)
>  rename src/py/libcamera/{pymain.cpp => py_main.cpp} (99%)
> 
> diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build
> index de66bb48..55957252 100644
> --- a/src/py/libcamera/meson.build
> +++ b/src/py/libcamera/meson.build
> @@ -13,21 +13,21 @@ pybind11_proj = subproject('pybind11')
>  pybind11_dep = pybind11_proj.get_variable('pybind11_dep')
>  
>  pycamera_sources = files([
> -    'pyenums.cpp',
> -    'pygeometry.cpp',
> -    'pymain.cpp',
> +    'py_enums.cpp',
> +    'py_geometry.cpp',
> +    'py_main.cpp',
>  ])
>  
>  gen_input_files = files([
>      '../../libcamera/control_ids.yaml',
> -    'pyenums_generated.cpp.in',
> +    'py_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 : ['pyenums_generated.cpp'],
> +                                  output : ['py_enums_generated.cpp'],
>                                    command : [gen_py_control_enums, '-o', '@OUTPUT@', '@INPUT@'])
>  
>  pycamera_sources += generated_sources
> diff --git a/src/py/libcamera/pyenums.cpp b/src/py/libcamera/py_enums.cpp
> similarity index 96%
> rename from src/py/libcamera/pyenums.cpp
> rename to src/py/libcamera/py_enums.cpp
> index b655e622..e55318f1 100644
> --- a/src/py/libcamera/pyenums.cpp
> +++ b/src/py/libcamera/py_enums.cpp
> @@ -13,7 +13,7 @@ namespace py = pybind11;
>  
>  using namespace libcamera;
>  
> -void init_pyenums(py::module &m)
> +void init_py_enums(py::module &m)
>  {
>         py::enum_<StreamRole>(m, "StreamRole")
>                 .value("StillCapture", StreamRole::StillCapture)
> diff --git a/src/py/libcamera/pyenums_generated.cpp.in b/src/py/libcamera/py_enums_generated.cpp.in
> similarity index 89%
> rename from src/py/libcamera/pyenums_generated.cpp.in
> rename to src/py/libcamera/py_enums_generated.cpp.in
> index 6aaf4795..20e07528 100644
> --- a/src/py/libcamera/pyenums_generated.cpp.in
> +++ b/src/py/libcamera/py_enums_generated.cpp.in
> @@ -15,7 +15,7 @@ namespace py = pybind11;
>  
>  using namespace libcamera;
>  
> -void init_pyenums_generated(py::module& m)
> +void init_py_enums_generated(py::module& m)
>  {
>  ${enums}
>  }
> diff --git a/src/py/libcamera/pygeometry.cpp b/src/py/libcamera/py_geometry.cpp
> similarity index 99%
> rename from src/py/libcamera/pygeometry.cpp
> rename to src/py/libcamera/py_geometry.cpp
> index d77de144..84b0cb08 100644
> --- a/src/py/libcamera/pygeometry.cpp
> +++ b/src/py/libcamera/py_geometry.cpp
> @@ -18,7 +18,7 @@ namespace py = pybind11;
>  
>  using namespace libcamera;
>  
> -void init_pygeometry(py::module &m)
> +void init_py_geometry(py::module &m)
>  {
>         auto pyPoint = py::class_<Point>(m, "Point");
>         auto pySize = py::class_<Size>(m, "Size");
> diff --git a/src/py/libcamera/pymain.cpp b/src/py/libcamera/py_main.cpp
> similarity index 99%
> rename from src/py/libcamera/pymain.cpp
> rename to src/py/libcamera/py_main.cpp
> index ef3f157a..b05bbb22 100644
> --- a/src/py/libcamera/pymain.cpp
> +++ b/src/py/libcamera/py_main.cpp
> @@ -130,15 +130,15 @@ static void handleRequestCompleted(Request *req)
>                 LOG(Fatal) << "Unable to write to eventfd";
>  }
>  
> -void init_pyenums(py::module &m);
> -void init_pyenums_generated(py::module &m);
> -void init_pygeometry(py::module &m);
> +void init_py_enums(py::module &m);
> +void init_py_enums_generated(py::module &m);
> +void init_py_geometry(py::module &m);
>  
>  PYBIND11_MODULE(_libcamera, m)
>  {
> -       init_pyenums(m);
> -       init_pyenums_generated(m);
> -       init_pygeometry(m);
> +       init_py_enums(m);
> +       init_py_enums_generated(m);
> +       init_py_geometry(m);
>  
>         /* Forward declarations */
>  
> -- 
> 2.34.1
>
Tomi Valkeinen May 18, 2022, 2:18 p.m. UTC | #3
On 18/05/2022 17:10, Kieran Bingham wrote:
> Quoting Tomi Valkeinen (2022-05-18 14:13:26)
>> Having the underscore makes the names more readable, especially when
>> there are multiple words in the name.
>>
> 
> Fine with me, is this going to break users of pycamera already? I.e.
> does picamera2 need a new rebase on top of this? If so - we should
> highlight this to RPi.

This patch? No, this is an internal change. The other patches in this 
series? Yes. Although, the bindings support that was merged was already 
different than the old-ish version that picamera2 uses/used.

  Tomi

Patch
diff mbox series

diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build
index de66bb48..55957252 100644
--- a/src/py/libcamera/meson.build
+++ b/src/py/libcamera/meson.build
@@ -13,21 +13,21 @@  pybind11_proj = subproject('pybind11')
 pybind11_dep = pybind11_proj.get_variable('pybind11_dep')
 
 pycamera_sources = files([
-    'pyenums.cpp',
-    'pygeometry.cpp',
-    'pymain.cpp',
+    'py_enums.cpp',
+    'py_geometry.cpp',
+    'py_main.cpp',
 ])
 
 gen_input_files = files([
     '../../libcamera/control_ids.yaml',
-    'pyenums_generated.cpp.in',
+    'py_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 : ['pyenums_generated.cpp'],
+                                  output : ['py_enums_generated.cpp'],
                                   command : [gen_py_control_enums, '-o', '@OUTPUT@', '@INPUT@'])
 
 pycamera_sources += generated_sources
diff --git a/src/py/libcamera/pyenums.cpp b/src/py/libcamera/py_enums.cpp
similarity index 96%
rename from src/py/libcamera/pyenums.cpp
rename to src/py/libcamera/py_enums.cpp
index b655e622..e55318f1 100644
--- a/src/py/libcamera/pyenums.cpp
+++ b/src/py/libcamera/py_enums.cpp
@@ -13,7 +13,7 @@  namespace py = pybind11;
 
 using namespace libcamera;
 
-void init_pyenums(py::module &m)
+void init_py_enums(py::module &m)
 {
 	py::enum_<StreamRole>(m, "StreamRole")
 		.value("StillCapture", StreamRole::StillCapture)
diff --git a/src/py/libcamera/pyenums_generated.cpp.in b/src/py/libcamera/py_enums_generated.cpp.in
similarity index 89%
rename from src/py/libcamera/pyenums_generated.cpp.in
rename to src/py/libcamera/py_enums_generated.cpp.in
index 6aaf4795..20e07528 100644
--- a/src/py/libcamera/pyenums_generated.cpp.in
+++ b/src/py/libcamera/py_enums_generated.cpp.in
@@ -15,7 +15,7 @@  namespace py = pybind11;
 
 using namespace libcamera;
 
-void init_pyenums_generated(py::module& m)
+void init_py_enums_generated(py::module& m)
 {
 ${enums}
 }
diff --git a/src/py/libcamera/pygeometry.cpp b/src/py/libcamera/py_geometry.cpp
similarity index 99%
rename from src/py/libcamera/pygeometry.cpp
rename to src/py/libcamera/py_geometry.cpp
index d77de144..84b0cb08 100644
--- a/src/py/libcamera/pygeometry.cpp
+++ b/src/py/libcamera/py_geometry.cpp
@@ -18,7 +18,7 @@  namespace py = pybind11;
 
 using namespace libcamera;
 
-void init_pygeometry(py::module &m)
+void init_py_geometry(py::module &m)
 {
 	auto pyPoint = py::class_<Point>(m, "Point");
 	auto pySize = py::class_<Size>(m, "Size");
diff --git a/src/py/libcamera/pymain.cpp b/src/py/libcamera/py_main.cpp
similarity index 99%
rename from src/py/libcamera/pymain.cpp
rename to src/py/libcamera/py_main.cpp
index ef3f157a..b05bbb22 100644
--- a/src/py/libcamera/pymain.cpp
+++ b/src/py/libcamera/py_main.cpp
@@ -130,15 +130,15 @@  static void handleRequestCompleted(Request *req)
 		LOG(Fatal) << "Unable to write to eventfd";
 }
 
-void init_pyenums(py::module &m);
-void init_pyenums_generated(py::module &m);
-void init_pygeometry(py::module &m);
+void init_py_enums(py::module &m);
+void init_py_enums_generated(py::module &m);
+void init_py_geometry(py::module &m);
 
 PYBIND11_MODULE(_libcamera, m)
 {
-	init_pyenums(m);
-	init_pyenums_generated(m);
-	init_pygeometry(m);
+	init_py_enums(m);
+	init_py_enums_generated(m);
+	init_py_geometry(m);
 
 	/* Forward declarations */