forked from mikelaramie/lw-gcp-cis-benchmark-json
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyenv-init.sh
executable file
·31 lines (26 loc) · 995 Bytes
/
pyenv-init.sh
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
#!/bin/bash
PYTHON_VERSION="3.8.10"
echo "[START] : pyenv setup ..."
if pyenv -v 1>/dev/null 2>&1 && pyenv virtualenv -h 1>/dev/null 2>&1; then
if ! pyenv versions | grep "$PYTHON_VERSION$" 1>/dev/null 2>&1; then
pyenv install $PYTHON_VERSION
echo "pyenv: installed python version $PYTHON_VERSION"
fi
if ! pyenv versions | grep "$PYTHON_VERSION/envs/azure-cfg-analyzer$" 1>/dev/null 2>&1; then
pyenv virtualenv $PYTHON_VERSION python_3.8.10
echo "created - virtualenv: 'python_3.8.10' python: '$PYTHON_VERSION'"
fi
if [ "$PYENV_VERSION" != "python_3.8.10" ] 1>/dev/null 2>&1; then
# Pyenv initialisations
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
pyenv activate python_3.8.10
echo "activated - virtualenv: 'python_3.8.10' python: '$PYTHON_VERSION'"
else
echo "virtualenv: 'python_3.8.10' python: '$PYTHON_VERSION' already activated"
fi
else
"missing pyenv/pyenv-virtualenv, please install and try again"
exit 1
fi
echo "[END] : pyenv setup"