[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 6/6] configure: Insist on a Python 2, not Python 3
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PATCH 6/6] configure: Insist on a Python 2, not Python 3 |
Date: |
Fri, 13 Apr 2012 10:39:16 +0100 |
From: Peter Maydell <address@hidden>
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 <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
configure | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/configure b/configure
index b392c6f..1d94acd 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
--
1.7.9.5
- [Qemu-devel] [PULL 0/6] Trivial patches for 4 to 13 April 2012, Stefan Hajnoczi, 2012/04/13
- [Qemu-devel] [PATCH 5/6] bsd-user: fix compile failure, Stefan Hajnoczi, 2012/04/13
- [Qemu-devel] [PATCH 1/6] configure: Remove useless uses of ARCH_CFLAGS, Stefan Hajnoczi, 2012/04/13
- [Qemu-devel] [PATCH 6/6] configure: Insist on a Python 2, not Python 3,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 3/6] make: Always set LC_ALL=C for makeinfo, Stefan Hajnoczi, 2012/04/13
- [Qemu-devel] [PATCH 2/6] configure: Fix wrong preprocessor statement, Stefan Hajnoczi, 2012/04/13
- [Qemu-devel] [PATCH 4/6] ps2: avoid repeated header file includes, Stefan Hajnoczi, 2012/04/13
- Re: [Qemu-devel] [PULL 0/6] Trivial patches for 4 to 13 April 2012, Anthony Liguori, 2012/04/13