declare -a VALID_PY_VERSIONS=("3.9" "3.8" "3.7" "3.6" "3.5")
PY_VERSION_FINAL=
PYTHON=
-VENV_BIN='virtualenv'
#-------------------------------------------------------------------
detect_color() {
fi
}
+#------------------------------------------------------------------------------
+RM() {
+
+ local cmd="rm $*"
+ if [[ "${VERBOSE}" == "y" ]] ; then
+ cmd="rm --verbose $*"
+ fi
+ debug "Executing: ${cmd}"
+ if [[ "${VERBOSE}" != "y" ]] ; then
+ rm "$@"
+ else
+ rm --verbose "$@"
+ fi
+
+}
+
#------------------------------------------------------------------------------
description() {
cat <<-EOF
exit 5
fi
- info "Searching for valid virtualenv …"
- VENV_BIN="virtualenv-${PY_VERSION_FINAL}"
- debug "Testing '${VENV_BIN}' …"
- if type -t "${VENV_BIN}" >/dev/null ; then
- :
- else
- VENV_BIN="virtualenv"
- debug "Testing '${VENV_BIN}' …"
- if type -t "${VENV_BIN}" >/dev/null ; then
- :
- else
- empty_line >&2
- error "Did not found a usable virtualenv." >&2
- error "Command '${RED}virtualenv${NORMAL}' not found, please install package '${YELLOW}python-virtualenv${NORMAL}' or appropriate."
- empty_line >&2
- exit 6
- fi
- fi
- info "Found '${GREEN}${VENV_BIN}${NORMAL}'."
-
if type -t msgfmt >/dev/null ; then
:
else
if [[ ! -f venv/bin/activate ]] ; then
- empty_line
- if [[ "${VENV_BIN}" == 'virtualenv' ]] ; then
- virtualenv --python="${PYTHON}" venv
- else
- ${VENV_BIN} venv
+ if [[ -e 'venv' ]] ; then
+ if [[ -d 'venv' ]] ; then
+ info "Removing directory '${CYAN}venv${NORMAL}' ..."
+ RM -r 'venv'
+ else
+ error "Path '${RED}venv${NORMAL}' exists, but is not a directory."
+ exit 11
+ fi
fi
+ empty_line
+ info "Creating virtual environment in '${CYAN}venv${NORMAL}' ..."
+ "${PYTHON}" -m venv venv
+
fi
# shellcheck disable=SC1091