Debian Codegraph @

scripts/run-in-env.sh

raw
1 #!/usr/bin/env sh
2 set -eu
3
4 # Used in venv activate script.
5 # Would be an error if undefined.
6 OSTYPE="${OSTYPE-}"
7
8 # Activate pyenv and virtualenv if present, then run the specified command
9
10 # pyenv, pyenv-virtualenv
11 if [ -s .python-version ]; then
12 PYENV_VERSION=$(head -n 1 .python-version)
13 export PYENV_VERSION
14 fi
15
16 # other common virtualenvs
17 my_path=$(git rev-parse --show-toplevel)
18
19 for venv in venv .venv .; do
20 if [ -f "${my_path}/${venv}/bin/activate" ]; then
21 . "${my_path}/${venv}/bin/activate"
22 break
23 fi
24 done
25
26 exec "$@"