File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # vim:ts=4:sts=4:sw=4:et
3+ #
4+ # Author: Hari Sekhon
5+ # Date: Mon Feb 22 17:42:01 2021 +0000
6+ #
7+ # https://github.com/HariSekhon/DevOps-Python-tools
8+ #
9+ # License: see accompanying Hari Sekhon LICENSE file
10+ #
11+ # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
12+ #
13+ # https://www.linkedin.com/in/HariSekhon
14+ #
15+
16+ # ============================================================================ #
17+ # P y t h o n D i r E n v
18+ # ============================================================================ #
19+
20+ # .envrc to auto-load the virtualenv inside the 'venv' directory if present
21+
22+ # https://direnv.net/man/direnv-stdlib.1.html
23+
24+ set -euo pipefail
25+ [ -n " ${DEBUG:- } " ] && set -x
26+ # srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
27+
28+ # this is necessary because newer versions of pip no longer allow you to install PyPI packages in system-packages by default
29+ for venv in " $PWD /venv" " $HOME /venv" ; do
30+ if [ -f " $venv /bin/activate" ]; then
31+ echo
32+ echo " Virtualenv directory found in: $venv "
33+ echo
34+ echo " Activating Virtualenv inside the directory: $venv "
35+
36+ # shellcheck disable=SC1091
37+ source " $venv /bin/activate"
38+ break
39+ fi
40+ done
41+
42+ # read .env too
43+ # dotenv
You can’t perform that action at this time.
0 commit comments