-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.envrc
29 lines (29 loc) · 914 Bytes
/
.envrc
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
#!/usr/bin/env bash
export PYTHON_KEYRING_BACKEND="keyring.backends.null.Keyring"
PROJECT_NAME=$(basename "$(pwd)")
export PROJECT_NAME
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export PROJECT_ROOT
VIRTUAL_ENV="./.venv"
if [ -e "${VIRTUAL_ENV}/bin/activate" ]; then
# shellcheck disable=SC1091
source "${VIRTUAL_ENV}/bin/activate"
else
make install
# shellcheck disable=SC1091
source "${VIRTUAL_ENV}/bin/activate"
python3 -m ensurepip --upgrade
python3 -m pip install --upgrade pip setuptools wheel
fi
# Load .env if it exists
if [ -f .env ]; then
# Load each line in .env file
while IFS= read -r line || [ -n "$line" ]; do
# Skip comments and empty lines
if [[ $line =~ ^[[:space:]]*# ]] || [[ -z $line ]]; then
continue
fi
# Export the valid environment variables
eval "export ${line}"
done < .env
fi