-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.envrc
45 lines (34 loc) · 1.72 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
41
42
43
44
45
set -e
# Upgrading Mac can uninstall the Command Line Tools, thus, removing our access to git
# The message talks about xcrun, however, we can use the lack of git as a way to know that we need this
# xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools),
# missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
if [ "$(uname -s)" == "Darwin" ] && [ ! -f "/Library/Developer/CommandLineTools/usr/bin/git" ]; then
echo -e "$(tput setaf 1)\nERROR: Complete the interactive installation (10+ mins) of the Command Line Tools.$(tput sgr0)"
xcode-select --install
return 1
fi
# don't write *.pyc files; using stale python code occasionally causes subtle problems
export PYTHONDONTWRITEBYTECODE=1
# Always write stdout immediately. Very helpful for debugging
export PYTHONUNBUFFERED=1
# make sure we don't have any conflicting PYTHONPATH
unset PYTHONPATH
# don't check pypi for a potential new pip version; low-hanging fruit to save a bit of time
export PIP_DISABLE_PIP_VERSION_CHECK=on
### You can override the exported variables with a .env file
# All exports should happen before here unless they're safeguarded (see devenv error reporting below)
if [ -f "${SENTRY_ROOT}/.env" ]; then
info "Loading variables from ${SENTRY_ROOT}/.env"
dotenv "${SENTRY_ROOT}/.env"
fi
### Python ###
venv_name=".venv"
# The user might be cd'ing into sentry with another non-direnv managed
# (in that it would be automatically deactivated) virtualenv active.
deactivate 2>/dev/null || true
# shellcheck disable=SC1091
source "${venv_name}/bin/activate"
# XXX: ideally, direnv is able to export PS1 as modified by sourcing venvs
# but we'd have to patch direnv, and ".venv" isn't descriptive anyways
unset PS1