in scripts/ebcli_installer.py [0:0]
def _ensure_not_inside_virtualenv_to_begin_with():
"""
Function checks whether the `VIRTUAL_ENV` environment variable has
already been set in effect checking whether a virtualenv is presently
active in the context of this shell. If so, this script is exited
immediately with a non-0 exit code.
Rationale:
1. when a virtualenv is entered current `PATH` is saved
2. real `PATH` is amended so that the `bin`/`Scripts` directory inside
the virtualenv is at the head of PATH
3. it is possible that the user (or a script such as this one) may
further amend the head of PATH.
4. all of the changes made to PATH will be lost upon deactivation
of the virtualenv thereby leading to unpredictable behaviour.
:return: None
:side-effect: script will exit with a non-0 return code if a
virtualenv has already been activated within the shell.
"""
if os.environ.get('VIRTUAL_ENV'):
_error('This script cannot be executed inside a virtual environment.')