diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-11-02 18:18:14 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-11-02 18:18:14 +0000 |
commit | 646142f5136da9cfe2b908703a822c53350f70e9 (patch) | |
tree | 2b38ba4fccc79154e9d5be1aed79179c8d9359f1 | |
parent | b4791fd4049d88421b240a17cc6417c0bbf8e795 (diff) | |
download | libguestfs-646142f5136da9cfe2b908703a822c53350f70e9.tar.gz libguestfs-646142f5136da9cfe2b908703a822c53350f70e9.tar.xz libguestfs-646142f5136da9cfe2b908703a822c53350f70e9.zip |
python: Correctly check for Python major/minor.
The manual for sys.version warns that you should not parse the string,
which we were doing. It would have failed on python "2.10" or
similar.
Do it correctly using the sys.version_info struct instead.
-rw-r--r-- | configure.ac | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 7a19e334..259e0930 100644 --- a/configure.ac +++ b/configure.ac @@ -713,7 +713,9 @@ AS_IF([test "x$enable_python" != "xno"], AC_MSG_RESULT([$PYTHON_PREFIX]) AC_MSG_CHECKING([Python version]) - PYTHON_VERSION=`$PYTHON -c "import sys; print (sys.version[[0:3]])"` + PYTHON_VERSION_MAJOR=`$PYTHON -c "import sys; print (sys.version_info.major)"` + PYTHON_VERSION_MINOR=`$PYTHON -c "import sys; print (sys.version_info.minor)"` + PYTHON_VERSION="$PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR" AC_MSG_RESULT([$PYTHON_VERSION]) AC_MSG_CHECKING([for Python include path]) |