Skip to content

Commit

Permalink
Read Poetry version from poetry.lock
Browse files Browse the repository at this point in the history
  • Loading branch information
jacebrowning committed Aug 26, 2023
1 parent b749315 commit 85b6cb2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,18 @@ for env_file in $BUILDPACK_VARIABLES ; do
[ -f "$ENV_DIR/$env_file" ] && export "$(basename "$env_file")=$(cat "$ENV_DIR/$env_file" 2>/dev/null)"
done

POETRY_VERSION="${POETRY_VERSION:-}"
if [ -z "${POETRY_VERSION:-}" ] ; then
export POETRY_VERSION=1.5.1
log "No Poetry version specified in POETRY_VERSION config var. Defaulting to $POETRY_VERSION."
if [ -f poetry.lock ]; then
POETRY_VERSION=$(head --lines=1 poetry.lock | grep --only-matching '\d\+\.\d\+\.\d\+')
fi
if [ -z "$POETRY_VERSION" ] ; then
export POETRY_VERSION=1.5.1
log "No Poetry version specified in POETRY_VERSION config var. Defaulting to $POETRY_VERSION."
else
export POETRY_VERSION
log "Using Poetry version from poetry.lock: $POETRY_VERSION"
fi
else
log "Using Poetry version from POETRY_VERSION config var: $POETRY_VERSION"
fi
Expand Down

0 comments on commit 85b6cb2

Please sign in to comment.