pipenv-python-version 627 Bytes
Newer Older
1 2
# Detect Python-version with Pipenv.

Kenneth Reitz's avatar
Kenneth Reitz committed
3
if [[ -f $BUILD_DIR/Pipfile ]]; then
4 5 6

    if [[ ! -f $BUILD_DIR/runtime.txt ]]; then
        if [[ ! -f Pipfile.lock ]]; then
Kenneth Reitz's avatar
Kenneth Reitz committed
7 8 9 10 11
            puts-warn "Pipfile.lock not found!"
        else
            set +e
            PYTHON=$(cat $BUILD_DIR/Pipfile.lock | jq '._meta.requires.python_version' -r) 2>&1 /dev/null
            set -e
12

Kenneth Reitz's avatar
Kenneth Reitz committed
13 14 15 16 17 18
            if [ "$PYTHON" = 2.7 ]; then
                echo "python-2.7.13" > $BUILD_DIR/runtime.txt
            fi
            if [ "$PYTHON" = 3.6 ]; then
                echo "python-3.6.0" > $BUILD_DIR/runtime.txt
            fi
19 20 21 22
        fi
    fi
fi