<div dir="ltr"><div>Hi Laurent,</div><div><br></div><div>The issue I was facing get fixed with the following changes mentioned by you.</div><div><br></div><div>-#!/usr/bin/python3<br></div><div>+#!/usr/bin/env python3<br></div><div><br></div><div>Thanks, for the update and immediate response. And we will be using this patch for our build system.</div><div><br></div><div>Best Regards</div><div>Madhavan K</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">---------- Forwarded message ---------<br>From: <strong class="gmail_sendername" dir="auto">Laurent Pinchart</strong> <span dir="auto"><<a href="mailto:laurent.pinchart@ideasonboard.com" target="_blank">laurent.pinchart@ideasonboard.com</a>></span><br>Date: Sun, 12 Jan 2020 at 01:37<br>Subject: Re: [libcamera-devel] [PATCH] meson: import python3 to use also from sysroot<br>To: Nicolas Dufresne <<a href="mailto:nicolas@ndufresne.ca" target="_blank">nicolas@ndufresne.ca</a>><br>Cc:  <<a href="mailto:madhavan.krishnan@linaro.org" target="_blank">madhavan.krishnan@linaro.org</a>>,  <<a href="mailto:libcamera-devel@lists.libcamera.org" target="_blank">libcamera-devel@lists.libcamera.org</a>><br></div><br><br>Hi Nicolas,<br>
<br>
On Sat, Jan 11, 2020 at 08:44:17AM -0500, Nicolas Dufresne wrote:<br>
> Le ven. 10 janv. 2020 08 h 05, <<a href="mailto:madhavan.krishnan@linaro.org" target="_blank">madhavan.krishnan@linaro.org</a>> a écrit :<br>
> > From: Madhavan Krishnan <<a href="mailto:madhavan.krishnan@linaro.org" target="_blank">madhavan.krishnan@linaro.org</a>><br>
> > <br>
> > importing python module can provide the exact path<br>
> > which can be used in desktop build as well as from<br>
> > any build system<br>
><br>
> Are you certain this is the right solution ? There is absolutely no other meson<br>
> project using this hack to call python script. I notice the shebang isn't<br>
> pythonic (not using env), could be that. I just don't believe such hack is<br>
> required. It's definately not in meson style.<br>
<br>
That's a good point. Madhavan, would the following patch fix your<br>
problem ? Nicolas, any objection against the Suggested-by line below ?<br>
<br>
commit 169165b9b00849d30774f2f1cffbdf49b934a717<br>
Author: Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com" target="_blank">laurent.pinchart@ideasonboard.com</a>><br>
Date:   Sat Jan 11 22:01:41 2020 +0200<br>
<br>
    libcamera: gen-controls.py: Don't hardcode path to python interpreter<br>
<br>
    The gen-controls.py script hardcodes the path to the python interpreter<br>
    to /usr/bin/python3 in the first line of the script. This hardcodes<br>
    usage of the host python3, even when building in cross-compilation<br>
    environments that may ship their own version of python. Fix it by<br>
    setting the interpreter to '/usr/bin/env python3'.<br>
<br>
    Reported-by: Madhavan Krishnan <<a href="mailto:madhavan.krishnan@linaro.org" target="_blank">madhavan.krishnan@linaro.org</a>><br>
    Suggested-by: Nicolas Dufresne <<a href="mailto:nicolas@ndufresne.ca" target="_blank">nicolas@ndufresne.ca</a>><br>
    Signed-off-by: Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com" target="_blank">laurent.pinchart@ideasonboard.com</a>><br>
<br>
diff --git a/src/libcamera/gen-controls.py b/src/libcamera/gen-controls.py<br>
index 940386cc68c8..2e5ac5c81cca 100755<br>
--- a/src/libcamera/gen-controls.py<br>
+++ b/src/libcamera/gen-controls.py<br>
@@ -1,4 +1,4 @@<br>
-#!/usr/bin/python3<br>
+#!/usr/bin/env python3<br>
 # SPDX-License-Identifier: GPL-2.0-or-later<br>
 # Copyright (C) 2019, Google Inc.<br>
 #<br>
<br>
> > ---<br>
> >  include/libcamera/meson.build | 4 +++-<br>
> >  src/libcamera/meson.build     | 4 +++-<br>
> >  2 files changed, 6 insertions(+), 2 deletions(-)<br>
> > <br>
> > diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build<br>
> > index 99abf06..83525e2 100644<br>
> > --- a/include/libcamera/meson.build<br>
> > +++ b/include/libcamera/meson.build<br>
> > @@ -21,13 +21,15 @@ include_dir = join_paths(libcamera_include_dir,<br>
> > 'libcamera')<br>
> >  install_headers(libcamera_api,<br>
> >                  subdir : include_dir)<br>
> > <br>
> > +python_mod = import('python3').find_python()<br>
> > +<br>
> >  gen_controls = files('../../src/libcamera/gen-controls.py')<br>
> > <br>
> >  control_ids_h = custom_target('control_ids_h',<br>
> >                                input : files('../../src/libcamera/<br>
> > control_ids.yaml', '<a href="http://control_ids.h.in" rel="noreferrer" target="_blank">control_ids.h.in</a>'),<br>
> >                                output : 'control_ids.h',<br>
> >                                depend_files : gen_controls,<br>
> > -                              command : [gen_controls, '-o', '@OUTPUT@',<br>
> > '@INPUT@'],<br>
> > +                              command : [python_mod, gen_controls, '-o',<br>
> > '@OUTPUT@', '@INPUT@'],<br>
> >                                install : true,<br>
> >                                install_dir : join_paths('include',<br>
> > include_dir))<br>
> > <br>
> > diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build<br>
> > index c4f965b..243935b 100644<br>
> > --- a/src/libcamera/meson.build<br>
> > +++ b/src/libcamera/meson.build<br>
> > @@ -65,13 +65,15 @@ if libudev.found()<br>
> >      ])<br>
> >  endif<br>
> > <br>
> > +python_mod = import('python3').find_python()<br>
> > +<br>
> >  gen_controls = files('gen-controls.py')<br>
> > <br>
> >  control_ids_cpp = custom_target('control_ids_cpp',<br>
> >                                  input : files('control_ids.yaml', '<br>
> > <a href="http://control_ids.cpp.in" rel="noreferrer" target="_blank">control_ids.cpp.in</a>'),<br>
> >                                  output : 'control_ids.cpp',<br>
> >                                  depend_files : gen_controls,<br>
> > -                                command : [gen_controls, '-o', '@OUTPUT@',<br>
> > '@INPUT@'])<br>
> > +                                command : [python_mod, gen_controls, '-o',<br>
> > '@OUTPUT@', '@INPUT@'])<br>
> > <br>
> >  libcamera_sources += control_ids_cpp<br>
> >  libcamera_sources += control_ids_h<br>
<br>
-- <br>
Regards,<br>
<br>
Laurent Pinchart<br>
</div></div></div>
</blockquote></div></div>