Some installations have several python versions installed. This patch
allows the user to choose which one to use by setting $PYTHON, otherwise it
falls back to 'python'.

Signed-off-by: Jon McCune <jonmcc...@google.com>

Thanks,
-Jon
Author: Jon McCune <jonmcc...@google.com>

    autogen.sh: Allow overriding the python to be used by setting $PYTHON.
    
    Some installations have several python versions installed. Allow user
    to choose which one to use by setting $PYTHON.

diff --git a/INSTALL b/INSTALL
index 846ac38..e5b0811 100644
--- a/INSTALL
+++ b/INSTALL
@@ -104,6 +104,9 @@ The simplest way to compile this package is:
   
   3. Type `./autogen.sh'.
 
+     * autogen.sh uses python. By default invocation is "python" but can be
+       overriden by setting variable $PYTHON.
+
   4. Type `./configure' to configure the package for your system.
      If you're using `csh' on an old version of System V, you might
      need to type `sh ./configure' instead to prevent `csh' from trying
diff --git a/autogen.sh b/autogen.sh
index 7424428..5020456 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -2,6 +2,9 @@
 
 set -e
 
+# Set ${PYTHON} to plain 'python' if not set already
+: ${PYTHON:=python}
+
 export LC_COLLATE=C
 unset LC_ALL
 
@@ -9,10 +12,10 @@ find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './b
 find util -iname '*.in' ! -name Makefile.in  |sort > po/POTFILES-shell.in
 
 echo "Importing unicode..."
-python util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c
+${PYTHON} util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c
 
 echo "Importing libgcrypt..."
-python util/import_gcry.py grub-core/lib/libgcrypt/ grub-core
+${PYTHON} util/import_gcry.py grub-core/lib/libgcrypt/ grub-core
 sed -n -f util/import_gcrypth.sed < grub-core/lib/libgcrypt/src/gcrypt.h.in > include/grub/gcrypt/gcrypt.h
 if [ -f include/grub/gcrypt/g10lib.h ]; then
     rm include/grub/gcrypt/g10lib.h
@@ -54,8 +57,8 @@ for extra in contrib/*/Makefile.core.def; do
   fi
 done
 
-python gentpl.py $UTIL_DEFS > Makefile.util.am
-python gentpl.py $CORE_DEFS > grub-core/Makefile.core.am
+${PYTHON} gentpl.py $UTIL_DEFS > Makefile.util.am
+${PYTHON} gentpl.py $CORE_DEFS > grub-core/Makefile.core.am
 
 for extra in contrib/*/Makefile.common; do
   if test -e "$extra"; then
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to