qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: marcandre.lureau@redhat.com, berrange@redhat.com,
	peter.maydell@linaro.org
Subject: [PATCH 2/3] configure: early test for Python
Date: Sun, 13 Sep 2020 12:05:33 +0200	[thread overview]
Message-ID: <20200913100534.22084-3-pbonzini@redhat.com> (raw)
In-Reply-To: <20200913100534.22084-1-pbonzini@redhat.com>

---
 configure | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/configure b/configure
index beae010e39..b4f5d2e272 100755
--- a/configure
+++ b/configure
@@ -1631,6 +1631,23 @@ for opt do
   esac
 done
 
+if test -n "$python"
+then
+    # Preserve python version since some functionality is dependent on it
+    python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0], sys.version_info[1], sys.version_info[2]))' 2>/dev/null)
+
+    # Suppress writing compiled files
+    python="$python -B"
+
+    # Note that if the Python conditional here evaluates True we will exit
+    # with status 1 which is a shell 'false' value.
+    if ! $python -c 'import sys; sys.exit(sys.version_info < (3,5))'; then
+        print_error "Cannot use '$python', Python >= 3.5 is required." \
+            "Use --python=/path/to/python to specify a supported Python."
+        python=
+    fi
+fi
+
 firmwarepath="${firmwarepath:-$prefix/share/qemu-firmware}"
 libdir="${libdir:-$prefix/lib}"
 libexecdir="${libexecdir:-$prefix/libexec}"
@@ -1962,19 +1979,6 @@ then
     error_exit "Python not found. Use --python=/path/to/python"
 fi
 
-# Note that if the Python conditional here evaluates True we will exit
-# with status 1 which is a shell 'false' value.
-if ! $python -c 'import sys; sys.exit(sys.version_info < (3,5))'; then
-  error_exit "Cannot use '$python', Python >= 3.5 is required." \
-      "Use --python=/path/to/python to specify a supported Python."
-fi
-
-# Preserve python version since some functionality is dependent on it
-python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0], sys.version_info[1], sys.version_info[2]))' 2>/dev/null)
-
-# Suppress writing compiled files
-python="$python -B"
-
 if test -z "$meson"; then
     if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.55.1; then
         meson=meson
-- 
2.26.2




  parent reply	other threads:[~2020-09-13 10:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-13 10:05 [RFC PATCH 0/3] Automatically convert configure options to meson build options Paolo Bonzini
2020-09-13 10:05 ` [PATCH 1/3] configure: quote command line arguments in config.status Paolo Bonzini
2020-09-14 19:17   ` Eric Blake
2020-09-13 10:05 ` Paolo Bonzini [this message]
2020-09-13 10:05 ` [PATCH 3/3] configure: automatically parse command line for meson -D options Paolo Bonzini
2020-09-14 19:20   ` Eric Blake
2020-09-13 10:15 ` [RFC PATCH 0/3] Automatically convert configure options to meson build options 罗勇刚(Yonggang Luo)
2020-09-13 13:57   ` Paolo Bonzini
2020-09-14  9:12 ` Daniel P. Berrangé
2020-09-14 10:49   ` Paolo Bonzini
2020-09-14  9:57 ` Stefan Hajnoczi
2020-09-14 10:00   ` 罗勇刚(Yonggang Luo)
2020-09-16 11:24     ` Stefan Hajnoczi
2020-09-14 10:27   ` Paolo Bonzini
2020-09-16 11:25     ` Stefan Hajnoczi
2020-09-16 13:15       ` Paolo Bonzini

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=20200913100534.22084-3-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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).