On 8/16/23 12:25, Pavel Hrdina wrote: > On Tue, Aug 15, 2023 at 02:45:37PM +0200, Michal Privoznik wrote: >> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> >> --- >> docs/meson.build | 7 +++---- >> meson.build | 4 ++-- >> src/access/meson.build | 6 +++--- >> src/meson.build | 43 +++++++++++++++++++---------------------- >> src/network/meson.build | 2 +- >> src/qemu/meson.build | 2 +- >> tests/meson.build | 2 +- >> 7 files changed, 31 insertions(+), 35 deletions(-) > > Not sure we can do this. In meson.build we have the following: > > required_programs = [ > 'perl', > 'python3', > 'xmllint', > 'xsltproc', > ] > > foreach name : required_programs > prog = find_program(name, dirs: libvirt_sbin_path) > varname = name.underscorify() > conf.set_quoted(varname.to_upper(), prog.full_path()) > set_variable('@0@_prog'.format(varname), prog) > endforeach > > which will set the python3_prog variable and we use that as our python > executable. > > I did a quick testing using the following meson.build file: > > ----------------------------------------------------------------------- > project('mesonpy', 'c') > > required_programs = [ > 'python3', > ] > > foreach name : required_programs > prog = find_program(name) > varname = name.underscorify() > set_variable('@0@_prog'.format(varname), prog) > endforeach > > res1 = run_command(python3_prog, 'script.py') > res2 = run_command('script.py') > > warning(res1.stdout()) > warning(res2.stdout()) > ----------------------------------------------------------------------- > > with the script.py having the following: > > ----------------------------------------------------------------------- > #!/usr/bin/env python3 > > import sys > > print(sys.version) > ----------------------------------------------------------------------- > > and when I changed PATH to have python3 pointing to python3.12 but my > system python is python3.11 I've got the following resutl: > > meson.build:16: WARNING: 3.12.0b4 (main, Jul 12 2023, 00:00:00) [GCC 13.1.1 20230614 (Red Hat 13.1.1-4)] > > meson.build:17: WARNING: 3.11.4 (main, Jun 7 2023, 00:00:00) [GCC 13.1.1 20230511 (Red Hat 13.1.1-2)] > > > Don't remember the origin of the wrapper but my guess is that this was > the main reason why we have it. Right. But this is expected, isn't it? The same way, if you'd change any other binary invoked from meson (say compiler) and we don't hardcode paths for them either. IOW - why should this behavior be problematic? BTW: we already invoke python scripts WITHOUT pytho3_prog and it didn't bother us yet: apibuild_prog, hyperv_wmi_generator_prog, esx_vi_generator_prog to name a few. Michal