DEBUG="n"
QUIET='n'
-VERSION="2.3"
+VERSION="2.4"
# console colors:
RED=""
CYAN=""
NORMAL=""
-BASENAME=$(basename "${0}")
+BASENAME=$( basename "${0}" )
BASE_DIR=$( dirname "$0" )
-cd "${BASE_DIR}" || exit 99
+cd "${BASE_DIR}"
BASE_DIR=$( readlink -f . )
+declare -a VALID_PY_VERSIONS=("3.10" "3.9" "3.8" "3.7" "3.6")
+
PIP_OPTIONS=
export VIRTUAL_ENV_DISABLE_PROMPT=y
-declare -a VALID_PY_VERSIONS=("3.10" "3.9" "3.8" "3.7" "3.6")
-PYTHON=
-
#-------------------------------------------------------------------
detect_color() {
# console colors:
if [ "${use_color}" = "true" ] ; then
- RED="\\033[38;5;196m"
- YELLOW="\\033[38;5;226m"
- GREEN="\\033[38;5;46m"
- # BLUE="\\033[38;5;27m"
- CYAN="\\033[38;5;36m"
- NORMAL="\\033[39m"
- # HAS_COLORS="y"
+ RED="\033[38;5;196m"
+ YELLOW="\033[38;5;226m"
+ GREEN="\033[38;5;46m"
+ # BLUE="\033[38;5;27m"
+ CYAN="\033[38;5;36m"
+ NORMAL="\033[39m"
else
RED=""
YELLOW=""
fi
local my_tty
-
- my_tty=$(tty)
+ my_tty=$( tty )
if [[ "${my_tty}" =~ 'not a tty' ]] ; then
my_tty='-'
fi
}
detect_color
+#------------------------------------------------------------------------------
my_date() {
date +'%F %T.%N %:::z'
}
local tmp=
local short_options="dvqhV"
local long_options="debug,verbose,quiet,help,version"
- local py_version=
- local py_found="n"
- local ret=
set +e
tmp=$( getopt -o "${short_options}" --long "${long_options}" -n "${BASENAME}" -- "$@" )
# BLUE=""
CYAN=""
NORMAL=""
- # HAS_COLORS="n"
shift
;;
--nocolor)
# BLUE=""
CYAN=""
NORMAL=""
- # HAS_COLORS="n"
shift
;;
-h|--help)
exit 1
fi
- py_found="n"
- info "Searching for valid Python …"
- for py_version in "${VALID_PY_VERSIONS[@]}" ; do
- PYTHON="python${py_version}"
- debug "Testing Python binary '${CYAN}${PYTHON}${NORMAL}' …"
- if type -t "${PYTHON}" >/dev/null ; then
- py_found="y"
- empty_line
- info "Found '${GREEN}${PYTHON}${NORMAL}'."
- break
- fi
- done
-
- if [[ "${py_found}" == "n" ]] ; then
- empty_line >&2
- error "Did not found a usable Python version." >&2
- error "Usable Python versions are: ${YELLOW}${VALID_PY_VERSIONS[*]}${NORMAL}." >&2
- empty_line >&2
- exit 5
- fi
-
if type -t msgfmt >/dev/null ; then
:
else
#------------------------------------------------------------------------------
init_venv() {
+ local py_version=
+ local python=
+ local found="n"
+
empty_line
line
info "Preparing virtual environment …"
if [[ ! -f venv/bin/activate ]] ; then
-
- empty_line
- "${PYTHON}" -m venv venv
-
+ found="n"
+ for py_version in "${VALID_PY_VERSIONS[@]}" ; do
+ python="python${py_version}"
+ debug "Testing Python binary '${CYAN}${python}${NORMAL}' …"
+ if type -t "${python}" >/dev/null ; then
+ found="y"
+ empty_line
+ info "Found '${GREEN}${python}${NORMAL}'."
+ empty_line
+ "${python}" -m venv venv
+ break
+ fi
+ done
+ if [[ "${found}" == "n" ]] ; then
+ empty_line >&2
+ error "Did not found a usable Python version." >&2
+ error "Usable Python versions are: ${YELLOW}${VALID_PY_VERSIONS[*]}${NORMAL}." >&2
+ empty_line >&2
+ exit 5
+ fi
fi
# shellcheck disable=SC1091
. venv/bin/activate || exit 5
- debug "Which pip: $(command -v pip)"
- debug "Which python: $(command -v python)"
}
fi
}
-#------------------------------------------------------------------------------
-compile_i18n() {
-
- if [[ -x compile-xlate-msgs.sh ]]; then
- line
- info "Updating i18n files in ${BASE_DIR} …"
- empty_line
- ./compile-xlate-msgs.sh
- empty_line
- fi
-}
-
################################################################################
##
## Main
exit 0
-# vim: ts=4
+# vim: ts=4 list