aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorCleber Rosa <crosa@redhat.com>2019-08-26 11:58:32 -0400
committerEduardo Habkost <ehabkost@redhat.com>2019-08-27 16:57:24 -0300
commit406ab2f331555cfcf320fe2a77949d7f8af7ab32 (patch)
tree05370dee5173e523b58cb2a0e61015722ef16ea0 /configure
parent73a5a775d273d34221889dc91be7580e26a9584d (diff)
downloadqemu-406ab2f331555cfcf320fe2a77949d7f8af7ab32.zip
qemu-406ab2f331555cfcf320fe2a77949d7f8af7ab32.tar.gz
qemu-406ab2f331555cfcf320fe2a77949d7f8af7ab32.tar.bz2
configure: more resilient Python version capture
The current approach to capture the Python version is fragile, as it was demonstrated by a very specific build of Python 3 on Fedora 29 that, under non-interactive shells would print multiline version information. The (badly) stripped version output would be sent to config-host.mak, producing bad syntax and rendering the makefiles unusable. Now, the Python versions is printed by configure, but only a simple (and better controlled variable) indicating whether the build system is using Python 2 is kept on config-host.mak. Signed-off-by: Cleber Rosa <crosa@redhat.com> Message-Id: <20190826155832.17427-1-crosa@redhat.com> Reviewed-by: Tony Nguyen <tony.nguyen@bt.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure5
1 files changed, 3 insertions, 2 deletions
diff --git a/configure b/configure
index e44e454..95134c0 100755
--- a/configure
+++ b/configure
@@ -1864,7 +1864,7 @@ if ! $python -c 'import sys; sys.exit(sys.version_info < (2,7))'; then
fi
# Preserve python version since some functionality is dependent on it
-python_version=$($python -V 2>&1 | sed -e 's/Python\ //')
+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"
@@ -6511,6 +6511,7 @@ if ! $python -c 'import sys; sys.exit(sys.version_info < (3,0))'; then
echo
echo "warning: Python 2 support is deprecated" >&2
echo "warning: Python 3 will be required for building future versions of QEMU" >&2
+ python2="y"
fi
config_host_mak="config-host.mak"
@@ -7333,7 +7334,7 @@ echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
echo "PYTHON=$python" >> $config_host_mak
-echo "PYTHON_VERSION=$python_version" >> $config_host_mak
+echo "PYTHON2=$python2" >> $config_host_mak
echo "CC=$cc" >> $config_host_mak
if $iasl -h > /dev/null 2>&1; then
echo "IASL=$iasl" >> $config_host_mak