Skip to content
Permalink
Browse files

Handle old direnv versions.

Change-Id: I89f4f1122c99ebb9b5240c127dcbb935383d8902
  • Loading branch information
svenpanne committed May 25, 2018
1 parent 361b908 commit ecaec6ca67b4587ba7177cdc62c41b48fd4b05ad
Showing with 23 additions and 1 deletion.
  1. +23 −1 .envrc
24 .envrc
@@ -1,2 +1,24 @@
mkdir -p .venv
# -*- mode: sh -*-
export PIPENV_VENV_IN_PROJECT=true

# TODO: Remove the copy-n-paste from direnv's stdlib when everybody uses at least
# direnv 2.14.0 (i.e. at least Ubuntu bionic)
if ! has layout_pipenv; then
layout_pipenv() {
if [[ ! -f Pipfile ]]; then
log_error 'No Pipfile found. Use `pipenv` to create a Pipfile first.'
exit 2
fi

local VENV=$(pipenv --bare --venv 2>/dev/null)
if [[ -z $VENV || ! -d $VENV ]]; then
pipenv install --dev
fi

export VIRTUAL_ENV=$(pipenv --venv)
PATH_add "$VIRTUAL_ENV/bin"
export PIPENV_ACTIVE=1
}
fi

layout pipenv

0 comments on commit ecaec6c

Please sign in to comment.
You can’t perform that action at this time.