mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-25 08:39:28 +00:00
autogen.sh: Detect python
It helps to avoid an error on distros which has only python3 binary: ./autogen.sh: line 20: python: command not found Use python3 as the default as python2 is EOL since Jan 2020. However, check also for python which is on most distros, if not all, python2 because code still works on python2. Although it should not be needed keep the possibility to define PYTHON variable. For detection use "command -v" which is POSIX and supported on all common shells (bash, zsh, dash, busybox sh, mksh) instead requiring "which" as an extra dependency (usable on containers). Update the INSTALL file too. Signed-off-by: Petr Vorel <pvorel@suse.cz> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
1 parent
ebed73d509
commit
8f35208db4
2 files changed
+18
-6
No files matched your search
+15
-2
@@ -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 python3 python; do
|
||||
if command -v "$i" > /dev/null 2>&1; then
|
||||
PYTHON="$i"
|
||||
echo "Using $PYTHON..."
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$PYTHON" ]; then
|
||||
echo "python not found." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
export LC_COLLATE=C
|
||||
unset LC_ALL
|
||||
|
||||
Reference in new issue
Block a user