Parhaps it is a missed one, that should be fixed :) With this patch, even if environment variable PYTHON pointed to Python 2, the configure script searches Python 3 at first. I'm irresolute that it is what it should be or not, and we should add --with-python argment to specify Python interpreter explicitly for this purpose or not.
[[[ configure: Search Python 3 before searching Python 2 for tests suite. * build/find_python.sh: Add option to specify version to search for. * configure.ac: Search Python 3 before searching Python 2 for tests suite. ]]] Cheers, -- Yasuhito FUTATSUKI <futat...@yf.bsclub.org>
Index: build/find_python.sh =================================================================== --- build/find_python.sh (revision 1885802) +++ build/find_python.sh (working copy) @@ -21,11 +21,28 @@ # # Required version of Python -VERSION=${1:-0x2070000} +case $1 in + -2) + CANDIDATE="$PYTHON $PYTHON2 python python2" + MIN_VER=${2:-0x2070000} + MAX_VER="0x3000000" + break + ;; + -3) + CANDIDATE="$PYTHON $PYTHON3 python python3" + MIN_VER=${2:-0x3000000} + MAX_VER="0xffffffff" + ;; + *) + CANDIDATE="$PYTHON $PYTHON3 python python3 $PYTHON2 python2" + MIN_VER=${1:-0x2070000} + MAX_VER="0xffffffff" +esac -for pypath in "$PYTHON" "$PYTHON2" "$PYTHON3" python python2 python3; do +for pypath in $CANDIDATE; do if [ "x$pypath" != "x" ]; then - DETECT_PYTHON="import sys;sys.exit((sys.hexversion < $VERSION) and 1 or 0)" + DETECT_PYTHON="import sys;\ + sys.exit(0 if $MIN_VER <= sys.hexversion < $MAX_VER else 1)" if "$pypath" -c "$DETECT_PYTHON" >/dev/null 2>/dev/null; then echo $pypath exit 0 Index: configure.ac =================================================================== --- configure.ac (revision 1885802) +++ configure.ac (working copy) @@ -1303,15 +1303,22 @@ # Python: Used for testsuite AC_ARG_VAR([PYTHON], [Python interpreter command]) -PYTHON="`$abs_srcdir/build/find_python.sh`" -if test -z "$PYTHON"; then - AC_MSG_WARN([Python 2.7 or later is required to run the testsuite.]) - AC_MSG_WARN([]) - AC_MSG_WARN([If you have a suitable Python installed, but not on the]) - AC_MSG_WARN([PATH, set the environment variable PYTHON to the full path]) - AC_MSG_WARN([to the Python executable, and re-run configure]) - PYTHON=none +detected_python="`$abs_srcdir/build/find_python.sh -3`" +if test -z "$detected_python"; then + detected_python="`$abs_srcdir/build/find_python.sh -2`" + if test -z "$detected_python"; then + AC_MSG_WARN([Python 2.7 or later is required to run the testsuite.]) + AC_MSG_WARN([]) + AC_MSG_WARN([If you have a suitable Python installed, but not on the]) + AC_MSG_WARN([PATH, set the environment variable PYTHON to the full path]) + AC_MSG_WARN([to the Python executable, and re-run configure]) + detected_python=none + else + AC_MSG_WARN([We recommend you to use Python 3 or later]) + AC_MSG_WARN([but only Python 2.7 is detected.]) + fi fi +PYTHON="$detected_python" AC_SUBST(PYTHON) # The minimum version for the JVM runtime for our Java bytecode.