diff mbox series

Add execute bit back to scripts/tracetool.py

Message ID 20200923103620.1980151-1-anthony.perard@citrix.com (mailing list archive)
State New, archived
Headers show
Series Add execute bit back to scripts/tracetool.py | expand

Commit Message

Zhijian Li (Fujitsu)" via Sept. 23, 2020, 10:36 a.m. UTC
Commit a81df1b68b65 ("libqemuutil, qapi, trace: convert to meson")
removed it without explanation and it is useful to be able to run a
script without having to figure out which interpreter to use.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 scripts/tracetool.py | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 scripts/tracetool.py

Comments

Philippe Mathieu-Daudé Sept. 23, 2020, 11:01 a.m. UTC | #1
On 9/23/20 12:36 PM, Anthony PERARD via wrote:
> Commit a81df1b68b65 ("libqemuutil, qapi, trace: convert to meson")
> removed it without explanation and it is useful to be able to run a
> script without having to figure out which interpreter to use.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
>  scripts/tracetool.py | 0
>  1 file changed, 0 insertions(+), 0 deletions(-)
>  mode change 100644 => 100755 scripts/tracetool.py
> 
> diff --git a/scripts/tracetool.py b/scripts/tracetool.py
> old mode 100644
> new mode 100755
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Paolo Bonzini Sept. 23, 2020, 11:14 a.m. UTC | #2
On 23/09/20 12:36, Anthony PERARD wrote:
> Commit a81df1b68b65 ("libqemuutil, qapi, trace: convert to meson")
> removed it without explanation and it is useful to be able to run a
> script without having to figure out which interpreter to use.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
>  scripts/tracetool.py | 0
>  1 file changed, 0 insertions(+), 0 deletions(-)
>  mode change 100644 => 100755 scripts/tracetool.py
> 
> diff --git a/scripts/tracetool.py b/scripts/tracetool.py
> old mode 100644
> new mode 100755
> 

The explanation is in docs/devel/build-system.rst

Support scripts
---------------

Meson has a special convention for invoking Python scripts: if their
first line is `#! /usr/bin/env python3` and the file is *not* executable,
find_program() arranges to invoke the script under the same Python
interpreter that was used to invoke Meson.  This is the most common
and preferred way to invoke support scripts from Meson build files,
because it automatically uses the value of configure's --python= option.

In case the script is not written in Python, use a `#! /usr/bin/env ...`
line and make the script executable.

Scripts written in Python, where it is desirable to make the script
executable (for example for test scripts that developers may want to
invoke from the command line, such as tests/qapi-schema/test-qapi.py),
should be invoked through the `python` variable in meson.build. For
example::

  test('QAPI schema regression tests', python,
       args: files('test-qapi.py'),
       env: test_env, suite: ['qapi-schema', 'qapi-frontend'])

This is needed to obey the --python= option passed to the configure
script, which may point to something other than the first python3
binary on the path.
Daniel P. Berrangé Sept. 23, 2020, 11:30 a.m. UTC | #3
On Wed, Sep 23, 2020 at 01:14:57PM +0200, Paolo Bonzini wrote:
> On 23/09/20 12:36, Anthony PERARD wrote:
> > Commit a81df1b68b65 ("libqemuutil, qapi, trace: convert to meson")
> > removed it without explanation and it is useful to be able to run a
> > script without having to figure out which interpreter to use.
> > 
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> > ---
> >  scripts/tracetool.py | 0
> >  1 file changed, 0 insertions(+), 0 deletions(-)
> >  mode change 100644 => 100755 scripts/tracetool.py
> > 
> > diff --git a/scripts/tracetool.py b/scripts/tracetool.py
> > old mode 100644
> > new mode 100755
> > 
> 
> The explanation is in docs/devel/build-system.rst
> 
> Support scripts
> ---------------
> 
> Meson has a special convention for invoking Python scripts: if their
> first line is `#! /usr/bin/env python3` and the file is *not* executable,
> find_program() arranges to invoke the script under the same Python
> interpreter that was used to invoke Meson.  This is the most common
> and preferred way to invoke support scripts from Meson build files,
> because it automatically uses the value of configure's --python= option.
> 
> In case the script is not written in Python, use a `#! /usr/bin/env ...`
> line and make the script executable.
> 
> Scripts written in Python, where it is desirable to make the script
> executable (for example for test scripts that developers may want to
> invoke from the command line, such as tests/qapi-schema/test-qapi.py),
> should be invoked through the `python` variable in meson.build. For
> example::
> 
>   test('QAPI schema regression tests', python,
>        args: files('test-qapi.py'),
>        env: test_env, suite: ['qapi-schema', 'qapi-frontend'])
> 
> This is needed to obey the --python= option passed to the configure
> script, which may point to something other than the first python3
> binary on the path.

The top level meson.build sets


  tracetool = [
    python, files('scripts/tracetool.py'),
     '--backend=' + config_host['TRACE_BACKENDS']
  ]

So looks like we're correctly honouring the configured --python
binary, and thus setting the executable bit will not cause any
problems with meson.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

Regards,
Daniel
Paolo Bonzini Sept. 23, 2020, 12:02 p.m. UTC | #4
On 23/09/20 12:36, Anthony PERARD wrote:
> Commit a81df1b68b65 ("libqemuutil, qapi, trace: convert to meson")
> removed it without explanation and it is useful to be able to run a
> script without having to figure out which interpreter to use.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
>  scripts/tracetool.py | 0
>  1 file changed, 0 insertions(+), 0 deletions(-)
>  mode change 100644 => 100755 scripts/tracetool.py
> 
> diff --git a/scripts/tracetool.py b/scripts/tracetool.py
> old mode 100644
> new mode 100755
> 

Cc: qemu-trivial@nongnu.org
Stefan Hajnoczi Sept. 23, 2020, 12:19 p.m. UTC | #5
On Wed, Sep 23, 2020 at 11:36:20AM +0100, Anthony PERARD wrote:
> Commit a81df1b68b65 ("libqemuutil, qapi, trace: convert to meson")
> removed it without explanation and it is useful to be able to run a
> script without having to figure out which interpreter to use.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
>  scripts/tracetool.py | 0
>  1 file changed, 0 insertions(+), 0 deletions(-)
>  mode change 100644 => 100755 scripts/tracetool.py

Thanks, applied to my tracing tree:
https://github.com/stefanha/qemu/commits/tracing

Stefan
diff mbox series

Patch

diff --git a/scripts/tracetool.py b/scripts/tracetool.py
old mode 100644
new mode 100755