From: Richard W.M. Jones Date: Thu, 3 Nov 2011 09:48:45 +0000 (+0000) Subject: python: Use sys.version_info[0] instead of sys.version_info.major. X-Git-Tag: 1.12.10~7 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=ecf483ac8e7cdf7145831b16ae98db3ec943ebc7;p=libguestfs.git python: Use sys.version_info[0] instead of sys.version_info.major. The major/minor fields only exist in Python >= 2.7. This works for at least Python 2.5 and 2.6. Thanks to Hilko Bengen. This updates commit 646142f5136da9cfe2b908703a822c53350f70e9. (cherry picked from commit 31e5539a14f78d8815d0d930e91023a65b5395e7) --- diff --git a/configure.ac b/configure.ac index 3f91193..de3d6f5 100644 --- a/configure.ac +++ b/configure.ac @@ -604,8 +604,8 @@ AS_IF([test "x$enable_python" != "xno"], AC_MSG_RESULT([$PYTHON_PREFIX]) AC_MSG_CHECKING([Python version]) - 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_MAJOR=`$PYTHON -c "import sys; print (sys.version_info@<:@0@:>@)"` + PYTHON_VERSION_MINOR=`$PYTHON -c "import sys; print (sys.version_info@<:@1@:>@)"` PYTHON_VERSION="$PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR" AC_MSG_RESULT([$PYTHON_VERSION])