cd ${base_dir}
base_dir=$( readlink -f . )
-if type -t virtualenv >/dev/null ; then
- :
-else
- echo "Command 'virtualenv' not found, please install package 'python-virtualenv' or appropriate." >&2
- exit 6
-fi
+declare -a VALID_PY_VERSIONS=("3.8" "3.7" "3.6" "3.5")
if type -t msgfmt >/dev/null ; then
:
exit 6
fi
-declare -a VALID_PY_VERSIONS=("3.8" "3.7" "3.6" "3.5")
-
+echo "---------------------------------------------------"
echo "Preparing virtual environment …"
-echo
if [[ ! -f venv/bin/activate ]] ; then
- found="n"
+
+ py_found="n"
for py_version in "${VALID_PY_VERSIONS[@]}" ; do
PYTHON="python${py_version}"
if type -t ${PYTHON} >/dev/null ; then
- found="y"
+ py_found="y"
echo
echo "Found ${PYTHON}."
+ break
+ fi
+ done
+
+ venv_bin='virtualenv'
+ venv_found="n"
+ for py_version in "${VALID_PY_VERSIONS[@]}" ; do
+ venv_bin="virtualenv-${py_version}"
+ if type -t ${venv_bin} >/dev/null ; then
+ venv_found="y"
echo
- virtualenv --python=${PYTHON} venv
+ echo "Found ${venv_bin}."
break
fi
done
- if [[ "${found}" == "n" ]] ; then
+ if [[ "${venv_found}" == "n" ]] ; then
+ venv_bin='virtualenv'
+ if type -t ${venv_bin} >/dev/null ; then
+ venv_found="y"
+ echo
+ echo "Found ${venv_bin}."
+ fi
+ fi
+
+ if [[ "${py_found}" == "n" ]] ; then
echo >&2
echo "Did not found a usable Python version." >&2
echo "Usable Python versions are: ${VALID_PY_VERSIONS[*]}" >&2
echo >&2
exit 5
fi
+
+ if [[ "${venv_found}" == "n" ]] ; then
+ echo >&2
+ echo "Did not found a usable virtualenv command." >&2
+ echo >&2
+ exit 6
+ fi
+
+ echo
+ if [[ "${venv_bin}" == 'virtualenv' ]] ; then
+ virtualenv --python=${PYTHON} venv
+ else
+ ${venv_bin} venv
+ fi
+
fi
. venv/bin/activate || exit 5
+echo
echo "---------------------------------------------------"
echo "Upgrading PIP ..."
echo "Fertig."
echo
-# vim: ts=4
+# vim: ts=4 list