]> Frank Brehm's Git Trees - pixelpark/admin-tools.git/commitdiff
Updating requirements.txt and update-env.sh
authorFrank Brehm <frank@brehm-online.com>
Mon, 17 Oct 2022 06:02:48 +0000 (08:02 +0200)
committerFrank Brehm <frank@brehm-online.com>
Mon, 17 Oct 2022 06:02:48 +0000 (08:02 +0200)
requirements.txt
update-env.sh

index a90700b8fd770fd30304a900471d1528f1b0b364..1d9073b6e554b92c5af57409d32cba5f1db75ece 100644 (file)
@@ -9,4 +9,4 @@ requests
 six
 setuptools
 wheel
-git+https://github.com/fbrehm/python_fb_tools.git@master
+fb-tools
index 19a4b4d1e5faa020963611a393cbcd12751f7a28..12ad319efea2028dd670a979c1ce48a18b4bdb5e 100755 (executable)
@@ -7,7 +7,7 @@ VERBOSE="n"
 DEBUG="n"
 QUIET='n'
 
-VERSION="2.3"
+VERSION="2.4"
 
 # console colors:
 RED=""
@@ -25,10 +25,7 @@ BASE_DIR=$( readlink -f . )
 PIP_OPTIONS=
 export VIRTUAL_ENV_DISABLE_PROMPT=y
 
-declare -a VALID_PY_VERSIONS=("3.9" "3.8" "3.7" "3.6" "3.5")
-PY_VERSION_FINAL=
-PYTHON=
-VENV_BIN='virtualenv'
+declare -a VALID_PY_VERSIONS=("3.10" "3.9" "3.8" "3.7" "3.6" "3.5")
 
 #-------------------------------------------------------------------
 detect_color() {
@@ -84,6 +81,7 @@ detect_color() {
 }
 detect_color
 
+#------------------------------------------------------------------------------
 my_date() {
     date +'%F %T.%N %:::z'
 }
@@ -255,48 +253,6 @@ get_options() {
         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"
-            PY_VERSION_FINAL="${py_version}"
-            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
-
-    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
@@ -315,6 +271,10 @@ get_options() {
 #------------------------------------------------------------------------------
 init_venv() {
 
+    local py_version=
+    local python=
+    local found="n"
+
     empty_line
     line
     info "Preparing virtual environment …"
@@ -322,14 +282,26 @@ init_venv() {
 
 
     if [[ ! -f venv/bin/activate ]] ; then
-
-        empty_line
-        if [[ "${VENV_BIN}" == 'virtualenv' ]] ; then
-            virtualenv --python="${PYTHON}" venv
-        else
-            ${VENV_BIN} 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