-
Notifications
You must be signed in to change notification settings - Fork 150
Expand file tree
/
Copy pathmadpack
More file actions
executable file
·66 lines (53 loc) · 1.79 KB
/
madpack
File metadata and controls
executable file
·66 lines (53 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# This script does the following:
# 0. If indicated by environent variables, look for DBMS-supplied Python
# installation. E.g., Greenplum supplies its own Python, and its currently
# the first choice to use because it guarantees that python, pygresql
# (currently needed to connect to a GP database), and libpg all have the same
# architecture.
# 1. Of step 0 failed, find python interpreter by
# - first looking for "python${VERSION}" in $PATH where
# ${VERSION} in {2.7, 2.6}
# - Only if that fails, look for "python" in $PATH
# 2. Pass all arguments to ../madpack/madpack.py
PYTHON_PREFIX="python"
PYTHON_VERSIONS="3"
# create absolute path to madpack.py
pushd `dirname $0` > /dev/null
MADPACK_PATH="$(pwd -P)/../madpack/madpack.py"
popd > /dev/null
# MADPACK_PATH="$(dirname 0)/../madpack/madpack.py"
# Initialization
DID_NOT_FIND_INTERPRETER=1
# Platform-specific overrides
if test "$GPHOME" && test "$PYTHONHOME" && \
test "${PYTHONHOME:0:${#GPHOME}}" = "$GPHOME"; then
DID_NOT_FIND_INTERPRETER=0
PYTHON_EXE_NAME="${PYTHONHOME}/bin/python"
fi
errorNoPythonFound() {
echo "No Python interpreter found. Please install Python 2.6 or higher to" \
"run madpack."
exit 1
}
setAndTestPythonVesion() {
PYTHON_EXE_NAME="${PYTHON_PREFIX}$1"
command -v "${PYTHON_EXE_NAME}" > /dev/null
DID_NOT_FIND_INTERPRETER=$?
}
# function main()
if test $DID_NOT_FIND_INTERPRETER -ne 0; then
for VERSION in $PYTHON_VERSIONS; do
setAndTestPythonVesion "${VERSION}"
if test $DID_NOT_FIND_INTERPRETER -eq 0; then
break
fi
done
fi
if test $DID_NOT_FIND_INTERPRETER -ne 0; then
setAndTestPythonVesion ""
fi
if test $DID_NOT_FIND_INTERPRETER -ne 0; then
errorNoPythonFound
fi
"$PYTHON_EXE_NAME" "${MADPACK_PATH}" "$@"