Module: check_mk
Branch: master
Commit: 3ccdfb90f3f5702354c587de9eef7d2c63949699
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3ccdfb90f3f570…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri May 25 11:03:28 2018 +0200
Handle old direnv versions.
Change-Id: I89f4f1122c99ebb9b5240c127dcbb935383d8902
---
.envrc | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/.envrc b/.envrc
index b16459f..1612729 100644
--- a/.envrc
+++ b/.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