[libcamera-devel,v1,1/1] utils: ipc: Update parser.py
diff mbox series

Message ID 20230331084545.633068-2-chenghaoyang@google.com
State Accepted
Commit c1cc37b2eeea33cbc0bdd1fe0d3ce57d2f321a85
Headers show
Series
  • utils: ipc: parser.py to prefer local mojom
Related show

Commit Message

Harvey Yang March 31, 2023, 8:45 a.m. UTC
Make the local mojom library the first priority in the sys path, to
avoid mixing the local one with the system one in build.

Tested on chromebook soraka-libcamera.

Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>
---
 utils/ipc/parser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kieran Bingham March 31, 2023, 12:32 p.m. UTC | #1
Hi Harvey,

Quoting Harvey Yang via libcamera-devel (2023-03-31 09:45:45)
> Make the local mojom library the first priority in the sys path, to
> avoid mixing the local one with the system one in build.
> 
> Tested on chromebook soraka-libcamera.
> 
> Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>

This looks reasonable to me, And easier to handle than the larger more
invasive change:

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

> ---
>  utils/ipc/parser.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/ipc/parser.py b/utils/ipc/parser.py
> index f46820fa..231a3266 100755
> --- a/utils/ipc/parser.py
> +++ b/utils/ipc/parser.py
> @@ -13,7 +13,7 @@ import sys
>  sys.dont_write_bytecode = True
>  
>  # Make sure that mojom_parser.py can import mojom
> -sys.path.append(f'{os.path.dirname(__file__)}/mojo/public/tools/mojom')
> +sys.path.insert(0, f'{os.path.dirname(__file__)}/mojo/public/tools/mojom')
>  
>  import mojo.public.tools.mojom.mojom_parser as parser
>  
> -- 
> 2.40.0.348.gf938b09366-goog
>
Laurent Pinchart April 5, 2023, 4:26 a.m. UTC | #2
Hi Harvey,

Thank you for the patch.

On Fri, Mar 31, 2023 at 08:45:45AM +0000, Harvey Yang via libcamera-devel wrote:
> Make the local mojom library the first priority in the sys path, to
> avoid mixing the local one with the system one in build.
> 
> Tested on chromebook soraka-libcamera.
> 
> Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>

I like small fixes :-)

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

> ---
>  utils/ipc/parser.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/ipc/parser.py b/utils/ipc/parser.py
> index f46820fa..231a3266 100755
> --- a/utils/ipc/parser.py
> +++ b/utils/ipc/parser.py
> @@ -13,7 +13,7 @@ import sys
>  sys.dont_write_bytecode = True
>  
>  # Make sure that mojom_parser.py can import mojom
> -sys.path.append(f'{os.path.dirname(__file__)}/mojo/public/tools/mojom')
> +sys.path.insert(0, f'{os.path.dirname(__file__)}/mojo/public/tools/mojom')
>  
>  import mojo.public.tools.mojom.mojom_parser as parser
Paul Elder April 5, 2023, 4:28 a.m. UTC | #3
On Fri, Mar 31, 2023 at 08:45:45AM +0000, Harvey Yang via libcamera-devel wrote:
> Make the local mojom library the first priority in the sys path, to
> avoid mixing the local one with the system one in build.
> 
> Tested on chromebook soraka-libcamera.

Thanks for the fix.

> 
> Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>

Looks good to me.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  utils/ipc/parser.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/ipc/parser.py b/utils/ipc/parser.py
> index f46820fa..231a3266 100755
> --- a/utils/ipc/parser.py
> +++ b/utils/ipc/parser.py
> @@ -13,7 +13,7 @@ import sys
>  sys.dont_write_bytecode = True
>  
>  # Make sure that mojom_parser.py can import mojom
> -sys.path.append(f'{os.path.dirname(__file__)}/mojo/public/tools/mojom')
> +sys.path.insert(0, f'{os.path.dirname(__file__)}/mojo/public/tools/mojom')
>  
>  import mojo.public.tools.mojom.mojom_parser as parser
>  
> -- 
> 2.40.0.348.gf938b09366-goog
>
Han-lin Chen April 7, 2023, 12:25 p.m. UTC | #4
Verified on ChromeOS.
Looks good to me.
Tested-by: Han-Lin Chen <hanlinchen@chromium.org>

On Wed, Apr 5, 2023 at 12:28 PM Paul Elder via libcamera-devel
<libcamera-devel@lists.libcamera.org> wrote:
>
> On Fri, Mar 31, 2023 at 08:45:45AM +0000, Harvey Yang via libcamera-devel wrote:
> > Make the local mojom library the first priority in the sys path, to
> > avoid mixing the local one with the system one in build.
> >
> > Tested on chromebook soraka-libcamera.
>
> Thanks for the fix.
>
> >
> > Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>
>
> Looks good to me.
>
> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
>
> > ---
> >  utils/ipc/parser.py | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/utils/ipc/parser.py b/utils/ipc/parser.py
> > index f46820fa..231a3266 100755
> > --- a/utils/ipc/parser.py
> > +++ b/utils/ipc/parser.py
> > @@ -13,7 +13,7 @@ import sys
> >  sys.dont_write_bytecode = True
> >
> >  # Make sure that mojom_parser.py can import mojom
> > -sys.path.append(f'{os.path.dirname(__file__)}/mojo/public/tools/mojom')
> > +sys.path.insert(0, f'{os.path.dirname(__file__)}/mojo/public/tools/mojom')
> >
> >  import mojo.public.tools.mojom.mojom_parser as parser
> >
> > --
> > 2.40.0.348.gf938b09366-goog
> >

Patch
diff mbox series

diff --git a/utils/ipc/parser.py b/utils/ipc/parser.py
index f46820fa..231a3266 100755
--- a/utils/ipc/parser.py
+++ b/utils/ipc/parser.py
@@ -13,7 +13,7 @@  import sys
 sys.dont_write_bytecode = True
 
 # Make sure that mojom_parser.py can import mojom
-sys.path.append(f'{os.path.dirname(__file__)}/mojo/public/tools/mojom')
+sys.path.insert(0, f'{os.path.dirname(__file__)}/mojo/public/tools/mojom')
 
 import mojo.public.tools.mojom.mojom_parser as parser