Ganeti is not yet ready for Python 3. Therefore, at configure-time, we effectively have two constraints for the version of Python to use: ">=2.6" and "<3.0". As, unfortunuately, the AM_PYTHON_PATH macro only supports minimal-version constraints, we afterwards verify that we got an interpreter for Python 2. We also tune the search heuristics to first check binaries that most likely are interpreters for Python 2. To also work with older versions of the autotools, we do the "<3.0" check manually and no rely on it already being supported in the AM_PYTHON_CHECK_VERSION macro.
Signed-off-by: Klaus Aehlig <[email protected]> --- configure.ac | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/configure.ac b/configure.ac index ee6dcee..fd2c7a5 100644 --- a/configure.ac +++ b/configure.ac @@ -886,7 +886,20 @@ fi AC_SUBST(MAN_HAS_WARNINGS) # Check for Python +# We need a Python-2 interpreter, version at least 2.6. As AM_PATH_PYTHON +# only supports a "minimal version" constraint, we check <3.0 afterwards. +# We tune _AM_PYTHON_INTERPRETER_LIST to first check interpreters that are +# likely interpreters for Python 2. +m4_define_default([_AM_PYTHON_INTERPRETER_LIST], [python2 python2.7 python2.6 python]) AM_PATH_PYTHON(2.6) +if $PYTHON -c "import sys +if (sys.hexversion >> 24) < 3: + sys.exit(1) +else: + sys.exit(0) +"; then + AC_MSG_FAILURE([Can only work with an interpreter for Python 2]) +fi AC_PYTHON_MODULE(OpenSSL, t) AC_PYTHON_MODULE(simplejson, t) -- 2.6.0.rc0.131.gf624c3d
