Skip to content
Snippets Groups Projects
pipenv-python-version 688 B
Newer Older
# Detect Python-version with Pipenv.

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

    if [[ ! -f $BUILD_DIR/runtime.txt ]]; then
        if [[ ! -f Pipfile.lock ]]; then
Kenneth Reitz's avatar
Kenneth Reitz committed
            puts-warn "Pipfile.lock not found!"
Kenneth Reitz's avatar
Kenneth Reitz committed
            echo '{}' > Pipfile.lock
        fi

        if [[ -f Pipfile.lock ]]; then
Kenneth Reitz's avatar
Kenneth Reitz committed
            set +e
Kenneth Reitz's avatar
Kenneth Reitz committed
            PYTHON=$(cat $BUILD_DIR/Pipfile.lock | jq '._meta.requires.python_version' -r)
Kenneth Reitz's avatar
Kenneth Reitz committed
            set -e
Kenneth Reitz's avatar
Kenneth Reitz committed
            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
Kenneth Reitz's avatar
Kenneth Reitz committed