-
Notifications
You must be signed in to change notification settings - Fork 1
/
.envrc
40 lines (33 loc) · 1.37 KB
/
.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
30
31
32
33
34
35
36
37
38
39
40
# Turns on shell execution strictness. This will force the .envrc
# evaluation context to exit immediately if:
#
# - any command in a pipeline returns a non-zero exit status that is
# not otherwise handled as part of `if`, `while`, or `until` tests,
# return value negation (`!`), or part of a boolean (`&&` or `||`)
# chain.
# - any variable that has not explicitly been set or declared (with
# either `declare` or `local`) is referenced.
strict_env
# Loads a ".env" file into the current environment
dotenv_if_exists "${PWD}"/../.env
dotenv_if_exists "${PWD}"/.env
# Add local scripts to PATH
PATH_add "${PWD}/bin"
# Disable macOS fork safety for Python compatibility
# https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#running-on-macos
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
# Make sure ansible-pylibssh can be compiled on macOS
if [[ -e /opt/homebrew/opt/libssh ]]; then
export LDFLAGS="-L/opt/homebrew/opt/libssh/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libssh/include"
fi
# Load poetry virtual env
if [[ ! -d "${PWD}/.venv" ]]; then
# link the poetry virtualenv to .venv for other tools to use
ln -nfs "$(poetry run poetry env info -p)" "${PWD}/.venv"
fi
export POETRY_ACTIVE=1
export VIRTUAL_ENV="${PWD}/.venv"
PATH_add "${VIRTUAL_ENV}/bin"
# shellcheck disable=SC2155
export PYTHON_SITE_DIR=$(echo "${VIRTUAL_ENV}"/lib/*/site-packages)