From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Eduardo Habkost" <ehabkost@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>
Subject: [Qemu-devel] [PATCH] configure: automatically pick python3 is available
Date: Fri, 1 Mar 2019 16:33:46 +0000 [thread overview]
Message-ID: <20190301163346.6545-1-berrange@redhat.com> (raw)
Unless overridden via an env var or configure arg, QEMU will only look
for the 'python' binary in $PATH. This is unhelpful on distros which
are only shipping Python 3.x (eg Fedora) in their default install as,
if they comply with PEP 394, the bare 'python' binary won't exist.
This changes configure so that by default it will search for all three
common python binaries, preferring to find Python 3.x versions.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
configure | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/configure b/configure
index 540bee19ba..ef2e5bf9f5 100755
--- a/configure
+++ b/configure
@@ -902,7 +902,10 @@ fi
: ${make=${MAKE-make}}
: ${install=${INSTALL-install}}
-: ${python=${PYTHON-python}}
+# We prefer python 3.x. A bare 'python' is traditionally
+# python 2.x, but some distros have it as python 3.x, so
+# we check that before python2
+: ${python=${PYTHON-python3 python python2}}
: ${smbd=${SMBD-/usr/sbin/smbd}}
# Default objcc to clang if available, otherwise use CC
@@ -1797,8 +1800,20 @@ EOF
exit 0
fi
-if ! has $python; then
- error_exit "Python not found. Use --python=/path/to/python"
+try_python="$python"
+python=
+for binary in $try_python
+do
+ if has $binary
+ then
+ python=$binary
+ break
+ fi
+done
+
+if test -z "$python"
+then
+ error_exit "Python not found. Use --python=/path/to/python"
fi
# Note that if the Python conditional here evaluates True we will exit
--
2.20.1
next reply other threads:[~2019-03-01 16:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-01 16:33 Daniel P. Berrangé [this message]
2019-03-01 16:48 ` [Qemu-devel] [PATCH] configure: automatically pick python3 is available Eric Blake
2019-03-01 16:50 ` Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190301163346.6545-1-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=ehabkost@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).