build: fix tools/configure in case only python3 exists
Calling ./configure with python3 being there but no python, tools/configure will fail. Fix that by defaulting to python and falling back to python3 or python2.
While at it fix the use of non portable "type -p" by replacing it by AC_PATH_PROG().
--- tools/configure.ac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/configure.ac +3 -2
@@ -337,8 +337,9 @@ case "$host_os" in freebsd*) ;; *) AX_PATH_PROG_OR_FAIL([BASH], [bash]);; esac -AS_IF([test -z "$PYTHON"], [PYTHON="python"]) -AS_IF([echo "$PYTHON" | grep -q "^/"], [], [PYTHON=`type -p "$PYTHON"`]) +AS_IF([test -z "$PYTHON"], [AC_CHECK_PROGS([PYTHON], [python python3 python2], err)]) +AS_IF([test "$PYTHON" = "err"], [AC_MSG_ERROR([No python interpreter found])]) +AS_IF([echo "$PYTHON" | grep -q "^/"], [], [AC_PATH_PROG([PYTHON], [$PYTHON])]) PYTHONPATH=$PYTHON PYTHON=`basename $PYTHONPATH`
Signature · 7 lines
2.16.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Wei Liu
Acked-byQuoted 8 lines · Juergen Gross
Calling ./configure with python3 being there but no python,
tools/configurewill fail. Fix that by defaulting to python and falling back to python3 or python2.While at it fix the use of non portable "type -p" by replacing it by
AC_PATH_PROG().Signed-off-by Juergen Gross <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Ian Jackson
Reviewed-byThanks for tidying this up.
Juergen Gross writes ("[PATCH-for-4.13] build: fix tools/configure in case only python3 exists"):
tools/configure.ac case "$host_os" in · line 341
Quoted 4 lines
tools/configure.ac +2
-2-AS_IF([test -z "$PYTHON"], [PYTHON="python"]) -AS_IF([echo "$PYTHON" | grep -q "^/"], [], [PYTHON=`type -p "$PYTHON"`]) +AS_IF([test -z "$PYTHON"], [AC_CHECK_PROGS([PYTHON], [python python3 python2], err)]) +AS_IF([test "$PYTHON" = "err"], [AC_MSG_ERROR([No python interpreter found])])
I think this use of `err' is a bit odd. According to the FM you could say simply:
+AS_IF([test -z "$PYTHON"], [AC_CHECK_PROGS([PYTHON], [python python3 python2])]) +AS_IF([test -z "$PYTHON"], [AC_MSG_ERROR([No python interpreter found])])
But this is a style nit I think since no-one will call their python interpreter `err' :-). And you will have tested your version and at this stage of 4.13 it would be better to have fewer iterations of this patch, so I think it should go in as it is.
Quoted 1 line
+AS_IF([echo "$PYTHON" | grep -q "^/"], [], [
AC_PATH_PROG([PYTHON], [$PYTHON])])
Thanks.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 19 lines · Ian Jackson
Thanks for tidying this up.
Juergen Gross writes ("[PATCH-for-4.13] build: fix
tools/configurein case only python3 exists"):tools/configure.ac case "$host_os" in · line 341
Quoted 4 lines
tools/configure.ac +2
-2-AS_IF([test -z "$PYTHON"], [PYTHON="python"]) -AS_IF([echo "$PYTHON" | grep -q "^/"], [], [PYTHON=`type -p "$PYTHON"`]) +AS_IF([test -z "$PYTHON"], [AC_CHECK_PROGS([PYTHON], [python python3 python2], err)]) +AS_IF([test "$PYTHON" = "err"], [AC_MSG_ERROR([No python interpreter found])])I think this use of `err' is a bit odd. According to the FM you could say simply:
+AS_IF([test -z "$PYTHON"], [
AC_CHECK_PROGS([PYTHON], [python python3 python2])]) +AS_IF([test -z "$PYTHON"], [AC_MSG_ERROR([No python interpreter found])])But this is a style nit I think since no-one will call their python interpreter `err' :-). And you will have tested your version and at this stage of 4.13 it would be better to have fewer iterations of this patch, so I think it should go in as it is.
Quoted 5 lines
Quoted 1 line
+AS_IF([echo "$PYTHON" | grep -q "^/"], [], [
AC_PATH_PROG([PYTHON], [$PYTHON])])Thanks.
Reviewed-by Ian Jackson <[email protected]>
Thanks. I will push this to staging and staging-4.13 shortly.
Wei.
Quoted 2 lines
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel