[libcamera-devel,6/8] utils: ipc: generate.py: Add bindings directory to Python path
diff mbox series

Message ID 20240104151548.2589-7-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • libcamera: Update mojo and mojo updater
Related show

Commit Message

Laurent Pinchart Jan. 4, 2024, 3:15 p.m. UTC
Newer mojo versions import a 'checks' module located in the bindings
directory. In preparation for a mojo update, add the directory to the
Python path make the import work.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 utils/ipc/generate.py | 2 ++
 1 file changed, 2 insertions(+)

Comments

Milan Zamazal Jan. 5, 2024, 10:09 a.m. UTC | #1
Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:

> Newer mojo versions import a 'checks' module located in the bindings
> directory. In preparation for a mojo update, add the directory to the
> Python path make the import work.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Milan Zamazal <mzamazal@redhat.com>

> ---
>  utils/ipc/generate.py | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/utils/ipc/generate.py b/utils/ipc/generate.py
> index 8771e0a6b9e3..afaf018b49d1 100755
> --- a/utils/ipc/generate.py
> +++ b/utils/ipc/generate.py
> @@ -12,6 +12,8 @@ import sys
>  # TODO set sys.pycache_prefix for >= python3.8
>  sys.dont_write_bytecode = True
>  
> +sys.path.insert(0, f'{os.path.dirname(__file__)}/mojo/public/tools/bindings')
> +
>  import mojo.public.tools.bindings.mojom_bindings_generator as generator
>  
>  def _GetModulePath(path, output_dir):
Kieran Bingham Jan. 9, 2024, 12:11 p.m. UTC | #2
Quoting Laurent Pinchart via libcamera-devel (2024-01-04 15:15:46)
> Newer mojo versions import a 'checks' module located in the bindings
> directory. In preparation for a mojo update, add the directory to the
> Python path make the import work.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

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

> ---
>  utils/ipc/generate.py | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/utils/ipc/generate.py b/utils/ipc/generate.py
> index 8771e0a6b9e3..afaf018b49d1 100755
> --- a/utils/ipc/generate.py
> +++ b/utils/ipc/generate.py
> @@ -12,6 +12,8 @@ import sys
>  # TODO set sys.pycache_prefix for >= python3.8
>  sys.dont_write_bytecode = True
>  
> +sys.path.insert(0, f'{os.path.dirname(__file__)}/mojo/public/tools/bindings')
> +
>  import mojo.public.tools.bindings.mojom_bindings_generator as generator
>  
>  def _GetModulePath(path, output_dir):
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/utils/ipc/generate.py b/utils/ipc/generate.py
index 8771e0a6b9e3..afaf018b49d1 100755
--- a/utils/ipc/generate.py
+++ b/utils/ipc/generate.py
@@ -12,6 +12,8 @@  import sys
 # TODO set sys.pycache_prefix for >= python3.8
 sys.dont_write_bytecode = True
 
+sys.path.insert(0, f'{os.path.dirname(__file__)}/mojo/public/tools/bindings')
+
 import mojo.public.tools.bindings.mojom_bindings_generator as generator
 
 def _GetModulePath(path, output_dir):