[v9_9] improve python probing
3946. [cleanup] Improved "configure" search for a python interpreter.
[RT #36992]
(cherry picked from commit 523f3d6302)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
3946. [cleanup] Improved "configure" search for a python interpreter.
|
||||
[RT #36992]
|
||||
|
||||
3945. [bug] Invalid wildcard expansions could be incorrectly
|
||||
accepted by the validator. [RT #37093]
|
||||
|
||||
|
||||
@@ -11614,15 +11614,22 @@ else
|
||||
fi
|
||||
|
||||
|
||||
python="python python3 python3.4 python3.3 python3.2 python3.1 python3.0 python2 python2.7 python2.6 python2.5 python2.4"
|
||||
testscript='try: import argparse
|
||||
except: exit(1)'
|
||||
case "$use_python" in
|
||||
no)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python support" >&5
|
||||
$as_echo_n "checking for python support... " >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
|
||||
$as_echo "disabled" >&6; }
|
||||
;;
|
||||
unspec|yes|*)
|
||||
case "$use_python" in
|
||||
unspec|yes|'')
|
||||
for ac_prog in python
|
||||
for p in $python
|
||||
do
|
||||
for ac_prog in $p
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
@@ -11667,9 +11674,43 @@ fi
|
||||
test -n "$PYTHON" && break
|
||||
done
|
||||
|
||||
if test "X$PYTHON" == "X"; then
|
||||
continue;
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking python module 'argparse'" >&5
|
||||
$as_echo_n "checking python module 'argparse'... " >&6; }
|
||||
if ${PYTHON:-false} -c "$testscript"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found, using $PYTHON" >&5
|
||||
$as_echo "found, using $PYTHON" >&6; }
|
||||
break
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
|
||||
$as_echo "not found" >&6; }
|
||||
unset ac_cv_path_PYTHON
|
||||
unset PYTHON
|
||||
done
|
||||
if test "X$PYTHON" == "X"
|
||||
then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python support" >&5
|
||||
$as_echo_n "checking for python support... " >&6; }
|
||||
case "$use_python" in
|
||||
unspec)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
|
||||
$as_echo "disabled" >&6; }
|
||||
;;
|
||||
yes)
|
||||
as_fn_error $? "missing python" "$LINENO" 5
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
for ac_prog in $use_python
|
||||
case "$use_python" in
|
||||
/*)
|
||||
PYTHON="$use_python"
|
||||
;;
|
||||
*)
|
||||
for ac_prog in $use_python
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
@@ -11714,44 +11755,19 @@ fi
|
||||
test -n "$PYTHON" && break
|
||||
done
|
||||
|
||||
;;
|
||||
esac
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking python module 'argparse'" >&5
|
||||
$as_echo_n "checking python module 'argparse'... " >&6; }
|
||||
if ${PYTHON:-false} -c "$testscript"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found, using $PYTHON" >&5
|
||||
$as_echo "found, using $PYTHON" >&6; }
|
||||
break
|
||||
else
|
||||
as_fn_error $? "not found" "$LINENO" 5
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if test "X$PYTHON" == "X"
|
||||
then
|
||||
case "$use_python" in
|
||||
unspec)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
|
||||
$as_echo "disabled" >&6; }
|
||||
;;
|
||||
yes|*)
|
||||
as_fn_error $? "missing python" "$LINENO" 5
|
||||
;;
|
||||
esac
|
||||
break
|
||||
fi
|
||||
testscript='try: import argparse
|
||||
except: exit(1)'
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking python module 'argparse'" >&5
|
||||
$as_echo_n "checking python module 'argparse'... " >&6; }
|
||||
if $PYTHON -c "$testscript"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found, using $PYTHON" >&5
|
||||
$as_echo "found, using $PYTHON" >&6; }
|
||||
else
|
||||
case "$use_python" in
|
||||
unspec)
|
||||
PYTHON=""
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found, python disabled" >&5
|
||||
$as_echo "not found, python disabled" >&6; }
|
||||
;;
|
||||
yes)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no found" >&5
|
||||
$as_echo "no found" >&6; }
|
||||
as_fn_error $? "python 'argparse' module not supported" "$LINENO" 5
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
+46
-33
@@ -149,50 +149,63 @@ AC_ARG_WITH(python,
|
||||
[ --with-python=PATH Specify path to python interpreter],
|
||||
use_python="$withval", use_python="unspec")
|
||||
|
||||
python="python python3 python3.4 python3.3 python3.2 python3.1 python3.0 python2 python2.7 python2.6 python2.5 python2.4"
|
||||
testscript='try: import argparse
|
||||
except: exit(1)'
|
||||
case "$use_python" in
|
||||
no)
|
||||
AC_MSG_CHECKING([for python support])
|
||||
AC_MSG_RESULT(disabled)
|
||||
;;
|
||||
unspec|yes|*)
|
||||
case "$use_python" in
|
||||
unspec|yes|'')
|
||||
AC_PATH_PROGS(PYTHON, python)
|
||||
for p in $python
|
||||
do
|
||||
AC_PATH_PROGS(PYTHON, $p)
|
||||
if test "X$PYTHON" == "X"; then
|
||||
continue;
|
||||
fi
|
||||
AC_MSG_CHECKING([python module 'argparse'])
|
||||
if ${PYTHON:-false} -c "$testscript"; then
|
||||
AC_MSG_RESULT([found, using $PYTHON])
|
||||
break
|
||||
fi
|
||||
AC_MSG_RESULT([not found])
|
||||
unset ac_cv_path_PYTHON
|
||||
unset PYTHON
|
||||
done
|
||||
if test "X$PYTHON" == "X"
|
||||
then
|
||||
AC_MSG_CHECKING([for python support])
|
||||
case "$use_python" in
|
||||
unspec)
|
||||
AC_MSG_RESULT(disabled)
|
||||
;;
|
||||
yes)
|
||||
AC_MSG_ERROR([missing python])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
AC_PATH_PROGS(PYTHON, $use_python)
|
||||
case "$use_python" in
|
||||
/*)
|
||||
PYTHON="$use_python"
|
||||
;;
|
||||
*)
|
||||
AC_PATH_PROGS(PYTHON, $use_python)
|
||||
;;
|
||||
esac
|
||||
AC_MSG_CHECKING([python module 'argparse'])
|
||||
if ${PYTHON:-false} -c "$testscript"; then
|
||||
AC_MSG_RESULT([found, using $PYTHON])
|
||||
break
|
||||
else
|
||||
AC_MSG_ERROR([not found])
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if test "X$PYTHON" == "X"
|
||||
then
|
||||
case "$use_python" in
|
||||
unspec)
|
||||
AC_MSG_RESULT(disabled)
|
||||
;;
|
||||
yes|*)
|
||||
AC_MSG_ERROR([missing python])
|
||||
;;
|
||||
esac
|
||||
break
|
||||
fi
|
||||
testscript='try: import argparse
|
||||
except: exit(1)'
|
||||
AC_MSG_CHECKING([python module 'argparse'])
|
||||
if $PYTHON -c "$testscript"; then
|
||||
AC_MSG_RESULT([found, using $PYTHON])
|
||||
else
|
||||
case "$use_python" in
|
||||
unspec)
|
||||
PYTHON=""
|
||||
AC_SUBST(CHECKDS)
|
||||
AC_SUBST(COVERAGE)
|
||||
AC_MSG_RESULT([not found, python disabled])
|
||||
;;
|
||||
yes)
|
||||
AC_MSG_RESULT([no found])
|
||||
AC_MSG_ERROR([python 'argparse' module not supported])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
Reference in New Issue
Block a user