|
@@ -12,12 +12,6 @@ bold="$(tput bold)"
|
|
|
reset="$(tput sgr0)"
|
|
|
|
|
|
venv_name=".venv"
|
|
|
-python_version="3.6"
|
|
|
-
|
|
|
-if [[ "$SENTRY_PYTHON2" = "1" ]]; then
|
|
|
- venv_name=".venv2"
|
|
|
- python_version="2.7"
|
|
|
-fi
|
|
|
|
|
|
die () {
|
|
|
cat <<EOF
|
|
@@ -29,42 +23,32 @@ EOF
|
|
|
if [[ -n "$VIRTUAL_ENV" ]]; then
|
|
|
major=`python -c "import sys; print(sys.version_info[0])"`
|
|
|
minor=`python -c "import sys; print(sys.version_info[1])"`
|
|
|
- # If .venv contains Python2 or SENTRY_PYTHON2 is set, then fail with instructions
|
|
|
- if [[ "$major" -eq 2 ]] || [[ ! -z "$SENTRY_PYTHON2" ]]; then
|
|
|
- cat << EOF
|
|
|
-${yellow}${bold}
|
|
|
-WARNING! You are running a Python 2 virtualenv, which is DEPRECATED.
|
|
|
-Support will be dropped beginning in 2021.
|
|
|
-${reset}
|
|
|
-EOF
|
|
|
- else
|
|
|
- # If .venv is less than Python 3.6 fail
|
|
|
- [[ "$minor" -lt 6 ]] &&
|
|
|
- die "Remove $VIRTUAL_ENV and try again since the Python version installed should be at least 3.6."
|
|
|
- # If .venv is created with Python greater than 3.6 you might encounter problems and we want to ask you to downgrade
|
|
|
- # unless you explicitely set an environment variable
|
|
|
- if [[ "$minor" -gt 6 ]]; then
|
|
|
- if [[ -n "$SENTRY_PYTHON_VERSION" ]]; then
|
|
|
- cat << EOF
|
|
|
+ # If .venv is less than Python 3.6 fail
|
|
|
+ [[ "$minor" -lt 6 ]] &&
|
|
|
+ die "Remove $VIRTUAL_ENV and try again since the Python version installed should be at least 3.6."
|
|
|
+ # If .venv is created with Python greater than 3.6 you might encounter problems and we want to ask you to downgrade
|
|
|
+ # unless you explicitely set an environment variable
|
|
|
+ if [[ "$minor" -gt 6 ]]; then
|
|
|
+ if [[ -n "$SENTRY_PYTHON_VERSION" ]]; then
|
|
|
+ cat << EOF
|
|
|
${yellow}${bold}
|
|
|
You have explicitly set a non-recommended Python version (${SENTRY_PYTHON_VERSION}). You're on your own.
|
|
|
${reset}
|
|
|
EOF
|
|
|
- else
|
|
|
- cat << EOF
|
|
|
+ else
|
|
|
+ cat << EOF
|
|
|
${red}${bold}
|
|
|
ERROR! You are running a virtualenv with a Python version different than 3.6
|
|
|
We recommend you start with a fresh virtualenv or to set the variable SENTRY_PYTHON_VERSION
|
|
|
to the Python version you want to use (e.g. 3.7).
|
|
|
${reset}
|
|
|
EOF
|
|
|
- exit 1
|
|
|
- fi
|
|
|
+ exit 1
|
|
|
fi
|
|
|
fi
|
|
|
else
|
|
|
if [[ ! -f "${venv_name}/bin/activate" ]]; then
|
|
|
- die "You don't seem to have a virtualenv. Please create one by running: python${python_version} -m virtualenv ${venv_name}"
|
|
|
+ die "You don't seem to have a virtualenv. Please create one by running: python3.6 -m venv ${venv_name}"
|
|
|
fi
|
|
|
die "You have a virtualenv, but it doesn't seem to be activated. Please run: source ${venv_name}/bin/activate"
|
|
|
fi
|