On Wed, Feb 22, 2023 at 03:37:47PM +0100, Paolo Bonzini wrote: > From: John Snow <js...@redhat.com> > > At the moment, we look for just "python3" and "python", which is good > enough almost all of the time. But ... if you are on a platform that > uses an older Python by default and only offers a newer Python as an > option, you'll have to specify --python=/usr/bin/foo every time. > > We can be kind and instead make a cursory attempt to locate a suitable > Python binary ourselves, looking for the remaining well-known binaries. > > This configure loop will use whatever is specified in $PYTHON or, if > empty, will try the following in order: > > 1. python3 > 2. python > 3. python3.11 down through python3.6 > > Notes: > > - Python virtual environment provides binaries for "python3", "python", > and whichever version you used to create the venv, > e.g. "python3.8". If configure is invoked from inside of a venv, this > configure loop will not "break out" of that venv unless that venv is > created using an explicitly non-suitable version of Python that we > cannot use. > > - In the event that no suitable python is found, the first python found > is the version used to generate the human-readable error message. > > - The error message isn't printed right away to allow later > configuration code to pick up an explicitly configured python. > > Signed-off-by: John Snow <js...@redhat.com> > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > configure | 63 ++++++++++++++++++++++++++++++++++++++++--------------- > 1 file changed, 46 insertions(+), 17 deletions(-)
Reviewed-by: Daniel P. Berrangé <berra...@redhat.com> With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|