[PATCH 3/3] meson: Drop python3_prog

Pavel Hrdina phrdina at redhat.com
Wed Aug 16 12:42:38 UTC 2023


On Wed, Aug 16, 2023 at 01:18:37PM +0200, Michal Prívozník wrote:
> 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 at redhat.com>
> >> ---
> >>  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 at _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 at _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?

After offlist discussion and explanation the patch will not be merged.

The main issue with this patch is that compiling libvirt would use
system python and not what user have in the current environment which is
not the same what happens with compiler or other binaries we are using
during compilation.

Pavel

> 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.

Yeah, some of them where broken by commit
<e06beacec2f8e57bbc5cd8f6eb9d44a1f291966d> and that should be fixed.

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20230816/d06f2f8d/attachment.sig>


More information about the libvir-list mailing list