-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipenv-python-version
35 lines (29 loc) · 1.15 KB
/
pipenv-python-version
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
#!/usr/bin/env bash
# Detect Python-version with Pipenv.
if [[ -f $BUILD_DIR/Pipfile ]]; then
if [[ ! -f $BUILD_DIR/runtime.txt ]]; then
if [[ ! -f $BUILD_DIR/Pipfile.lock ]]; then
puts-warn "No 'Pipfile.lock' found! We recommend you commit this into your repository."
fi
if [[ -f $BUILD_DIR/Pipfile.lock ]]; then
set +e
PYTHON=$(jq -r '._meta.requires.python_full_version' "$BUILD_DIR/Pipfile.lock")
if [[ "$PYTHON" != "null" ]]; then
echo "python-$PYTHON" > "$BUILD_DIR/runtime.txt"
fi
set -e
if [[ "$PYTHON" == "null" ]]; then
PYTHON=$(jq -r '._meta.requires.python_version' "$BUILD_DIR/Pipfile.lock")
if [ "$PYTHON" = 2.7 ]; then
echo "$LATEST_27" > "$BUILD_DIR/runtime.txt"
fi
if [ "$PYTHON" = 3.6 ]; then
echo "$LATEST_36" > "$BUILD_DIR/runtime.txt"
fi
if [ "$PYTHON" = 3.7 ]; then
echo "$LATEST_37" > "$BUILD_DIR/runtime.txt"
fi
fi
fi
fi
fi