]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Adding and using requirements-backports-3.9.txt on Python < 3.9
authorFrank Brehm <frank.brehm@pixelpark.com>
Mon, 8 Apr 2024 12:51:10 +0000 (14:51 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Mon, 8 Apr 2024 12:51:10 +0000 (14:51 +0200)
requirements-backports-3.9.txt [new file with mode: 0644]
update-env.sh

diff --git a/requirements-backports-3.9.txt b/requirements-backports-3.9.txt
new file mode 100644 (file)
index 0000000..5a8be64
--- /dev/null
@@ -0,0 +1 @@
+backports.zoneinfo
index 53625a71f7962b3981b0ac31f7b522340496c7c4..6a5f8ca61db8fec2e271eb9dd0e16c9041441dab 100755 (executable)
@@ -23,11 +23,13 @@ BASE_DIR=$( dirname "$0" )
 cd "${BASE_DIR}"
 BASE_DIR=$( readlink -f . )
 
-declare -a VALID_PY_VERSIONS=("3.10" "3.9" "3.8" "3.7" "3.6")
+declare -a VALID_PY_VERSIONS=("3.11." "3.10" "3.9" "3.8" "3.7" "3.6")
 
 PIP_OPTIONS=
 export VIRTUAL_ENV_DISABLE_PROMPT=y
 
+PYTHON_MINOR_VERSION=
+
 #-------------------------------------------------------------------
 detect_color() {
 
@@ -301,6 +303,7 @@ init_venv() {
     # shellcheck disable=SC1091
     . venv/bin/activate || exit 5
 
+    PYTHON_MINOR_VERSION=$( python3 -c 'import sys; print(sys.version_info.minor)' )
 }
 
 #------------------------------------------------------------------------------
@@ -336,6 +339,14 @@ upgrade_modules() {
         pip install ${PIP_OPTIONS} --upgrade --upgrade-strategy eager --requirement requirements-lint.txt
         empty_line
     fi
+
+    if [[ -f requirements-backports-3.9.txt && -n "${PYTHON_MINOR_VERSION}" && "${PYTHON_MINOR_VERSION}" -lt 9 ]] ; then
+        info "Installing modules necessary for Python <3.9 …"
+        empty_line
+        pip install ${PIP_OPTIONS} --upgrade --upgrade-strategy eager --requirement requirements-backports-3.9.txt
+        empty_line
+    fi
+
 }
 
 #------------------------------------------------------------------------------