summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2012-04-12 19:09:52 +0100
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2012-04-13 10:01:35 +0100
commit6ccea1e4d9a39d0bcf5be5a7b49270c2132b9dcb (patch)
tree8ffa470612bd1d378e7ef2662883c515f20f22c8 /configure
parentd6ef40bf1881ddc82c8d64e72d412090efe1190e (diff)
downloadqemu-6ccea1e4d9a39d0bcf5be5a7b49270c2132b9dcb.tar.gz
configure: Insist on a Python 2, not Python 3
Our Python scripts require Python 2 and will fail on Python 3, eg: File "/home/petmay01/linaro/qemu-from-laptop/qemu/scripts/qapi-commands.py", line 378 except getopt.GetoptError, err: ^ SyntaxError: invalid syntax Add a check to configure that Python is not a Python 3, so we can fail with a comprehensible error rather than an obscure one. Reported-by: Boris Matti <swiftos@lavabit.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure8
1 files changed, 8 insertions, 0 deletions
diff --git a/configure b/configure
index b392c6f390..1d94acda2c 100755
--- a/configure
+++ b/configure
@@ -1242,6 +1242,14 @@ if ! has $python; then
exit 1
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[0] >= 3)'; then
+ echo "Python 2 required but '$python' is version 3 or better."
+ echo "Use --python=/path/to/python to specify a Python 2."
+ exit 1
+fi
+
if test -z "$target_list" ; then
target_list="$default_target_list"
else