It help to avoid error on distros which has only python3 binary: ./autogen.sh: line 20: python: command not found
Using bash builtin 'command -v' to avoid requiring which as extra dependency (usable on containers). Keep the possibility to define PYTHON. Signed-off-by: Petr Vorel <pvo...@suse.cz> --- autogen.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/autogen.sh b/autogen.sh index 31b0ced7e..46f9e1a6d 100755 --- a/autogen.sh +++ b/autogen.sh @@ -7,8 +7,21 @@ if [ ! -e grub-core/lib/gnulib/stdlib.in.h ]; then exit 1 fi -# Set ${PYTHON} to plain 'python' if not set already -: ${PYTHON:=python} +# Detect python +if [ -z "$PYTHON" ]; then + for i in python python3 python2; do + if command -v "$i" > /dev/null 2>&1; then + PYTHON="$i" + echo "Using $PYTHON" >&2 + break + fi + done + + if [ -z "$PYTHON" ]; then + echo "python not found" >&2 + exit 1 + fi +fi export LC_COLLATE=C unset LC_ALL -- 2.32.0 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel