common.sh 761 Bytes
Newer Older
1
VER=2
2
if [ "${1-}" = "-3" ]; then
3 4 5 6
    VER=3
    shift
fi

7 8 9 10 11 12 13 14 15 16 17 18 19 20

if [ -z "${PYTHON2-}" ]; then
    which python2.7 >/dev/null 2>&1 && PYTHON2=$(which python2.7)
    which python2 >/dev/null 2>&1 && PYTHON2=$(which python2)
fi

if [ -z "${PYTHON3-}" ]; then
    which python3.4 >/dev/null 2>&1 && PYTHON3=$(which python3.4)
    which python3.5 >/dev/null 2>&1 && PYTHON3=$(which python3.5)
    which python3.6 >/dev/null 2>&1 && PYTHON3=$(which python3.6)
    which python3 >/dev/null 2>&1 && PYTHON3=$(which python3)
fi

if [ -z "${PYTHON-}" ]; then
21
    which python >/dev/null 2>&1 && PYTHON=$(which python)
22 23 24 25
    if [ $VER -eq 2 -a -n "${PYTHON2}" ]; then
        PYTHON=${PYTHON2}
    elif [ $VER -eq 3 -a -n "${PYTHON3}" ]; then
        PYTHON=${PYTHON3}
26 27
    fi
fi