summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/get-antlr-3.44
-rw-r--r--contrib/get-script-header.sh16
2 files changed, 16 insertions, 4 deletions
diff --git a/contrib/get-antlr-3.4 b/contrib/get-antlr-3.4
index 6bfa18c46..a3dfb410d 100755
--- a/contrib/get-antlr-3.4
+++ b/contrib/get-antlr-3.4
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
source "$(dirname "$0")/get-script-header.sh"
ANTLR_HOME_DIR=antlr-3.4
@@ -46,7 +46,7 @@ cd libantlr3c-3.4
# Use an absolute path for the installation directory to avoid spurious libtool
# warnings about the ANTLR library having moved
-PREFIX=$(python -c "import os; print(os.path.realpath('$(pwd)/../..'))")
+PREFIX=$($PYTHON -c "import os; print(os.path.realpath('$(pwd)/../..'))")
# Make antlr3debughandlers.c empty to avoid unreferenced symbols
rm -rf src/antlr3debughandlers.c && touch src/antlr3debughandlers.c
diff --git a/contrib/get-script-header.sh b/contrib/get-script-header.sh
index de4a93587..e5b708042 100644
--- a/contrib/get-script-header.sh
+++ b/contrib/get-script-header.sh
@@ -1,6 +1,6 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
-set -e
+set -e -o pipefail
cd "$(dirname "$0")/.."
@@ -24,3 +24,15 @@ function webget {
exit 1
fi
}
+
+for cmd in python python2 python3; do
+ if [ -x "$(command -v $cmd)" ]; then
+ PYTHON="$cmd"
+ break
+ fi
+done
+
+if [ -z "$PYTHON" ]; then
+ echo "Error: Couldn't find python, python2, or python3." >&2
+ exit 1
+fi
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback