|
@@ -31,7 +31,7 @@ EOF
|
|
|
}
|
|
|
|
|
|
require() {
|
|
|
- command -v "$1" 2>&1 >/dev/null
|
|
|
+ command -v "$1" >/dev/null 2>&1
|
|
|
}
|
|
|
|
|
|
warn() {
|
|
@@ -59,9 +59,9 @@ advice_init_venv() {
|
|
|
venv_name="$2"
|
|
|
|
|
|
deactivate 2>/dev/null || true
|
|
|
- info "To create a virtualenv, please type: ${python_version} -m virtualenv ${venv_name}"
|
|
|
- require ${python_version} ||
|
|
|
- die "You'll need to install ${python_version}, or make it available on your PATH.
|
|
|
+ info "To create a virtualenv, please type: python${python_version} -m virtualenv ${venv_name}"
|
|
|
+ require "python${python_version}" ||
|
|
|
+ die "You'll need to install python${python_version}, or make it available on your PATH.
|
|
|
It's recommended to use pyenv - please refer to https://docs.sentry.io/development/contribute/environment"
|
|
|
return 1
|
|
|
}
|
|
@@ -121,16 +121,12 @@ make setup-git-config
|
|
|
|
|
|
### Python ###
|
|
|
|
|
|
-# we're enforcing that virtualenv be in .venv{,3}, since future tooling e.g.
|
|
|
-# venv-update will rely on this.
|
|
|
venv_name=".venv"
|
|
|
-python_version="python2.7"
|
|
|
+python_version="3.6"
|
|
|
|
|
|
-if [ "$SENTRY_PYTHON3" = "1" ]; then
|
|
|
- venv_name=".venv3"
|
|
|
- python_version="python3.6"
|
|
|
-
|
|
|
- warn "Running in EXPERIMENTAL Python 3 mode... Good luck"
|
|
|
+if [ "$SENTRY_PYTHON2" = "1" ]; then
|
|
|
+ venv_name=".venv2"
|
|
|
+ python_version="2.7"
|
|
|
fi
|
|
|
|
|
|
info "Activating virtualenv..."
|
|
@@ -144,7 +140,7 @@ fi
|
|
|
# (in that it would be automatically deactivated) virtualenv active.
|
|
|
deactivate 2>/dev/null || true
|
|
|
|
|
|
-source ${venv_name}/bin/activate
|
|
|
+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
|
|
@@ -157,16 +153,11 @@ if [ "$(command -v python)" != "${PWD}/${venv_name}/bin/python" ]; then
|
|
|
advice_init_venv "$python_version" "$venv_name"
|
|
|
fi
|
|
|
|
|
|
-if [ "$SENTRY_PYTHON3" = "1" ]; then
|
|
|
- python -c "import sys; sys.exit(sys.version_info[:2] != (3, 6))" ||
|
|
|
- die "For some reason, the virtualenv isn't Python 3.6."
|
|
|
-else
|
|
|
- python -c "import sys; sys.exit(sys.version_info[:2] != (2, 7))" ||
|
|
|
- die "For some reason, the virtualenv isn't Python 2.7."
|
|
|
-fi
|
|
|
+info "Ensuring proper virtualenv..."
|
|
|
+${PWD}/scripts/ensure-venv.sh
|
|
|
|
|
|
if [ "$(command -v sentry)" != "${PWD}/${venv_name}/bin/sentry" ]; then
|
|
|
- info "Your virtual env is activated, but sentry doesn't seem to be installed."
|
|
|
+ info "Your virtualenv is activated, but sentry doesn't seem to be installed."
|
|
|
# XXX: if direnv fails, the venv won't be activated outside of direnv execution...
|
|
|
# So, it is critical that make install-py-dev is guarded by scripts/ensure-venv.
|
|
|
advice_install_sentry
|
|
@@ -210,7 +201,7 @@ ${green}${bold}direnv: SUCCESS!
|
|
|
${reset}
|
|
|
EOF
|
|
|
|
|
|
-if [ ! -n "${SENTRY_SILENCE_DIRENV_NOTICE:-}" ]; then
|
|
|
+if [ -z "${SENTRY_SILENCE_DIRENV_NOTICE:-}" ]; then
|
|
|
cat <<EOF
|
|
|
direnv tooling is in an ALPHA state!
|
|
|
If you're having trouble, or have questions, please ask in #discuss-dev-tooling
|