On Fri, 5 Sept 2025 at 08:26, Paolo Bonzini <pbonz...@redhat.com> wrote: > > On 9/4/25 17:11, Peter Foley wrote: > > Relying on `python3` to be avilable in $PATH doesn't work in some build > > environments. Update the build files to use the found python binary > > explicitly. > > Meson already does this, if the file is not executable. See > docs/devel/build-system.rst: > > 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. > > Using "[python, 'foo']" is only needed for scripts "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)".
Wow, this seems like a super fragile way to do things. My natural expectation would be that scripts generally would be executable. If we accidentally make a script executable that meson is invoking without explicit [python, ...] then everything continues to work for almost everybody, except in this corner case where the 'python3' on the path is sufficiently wrong to not work: so we're likely to not notice the mistake for ages. -- PMM