From 133229fbfb570c63a2ccf0d1d91cc20bb13ce5e6 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Mon, 8 Apr 2024 14:51:10 +0200 Subject: [PATCH] Adding and using requirements-backports-3.9.txt on Python < 3.9 --- requirements-backports-3.9.txt | 1 + update-env.sh | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 requirements-backports-3.9.txt diff --git a/requirements-backports-3.9.txt b/requirements-backports-3.9.txt new file mode 100644 index 0000000..5a8be64 --- /dev/null +++ b/requirements-backports-3.9.txt @@ -0,0 +1 @@ +backports.zoneinfo diff --git a/update-env.sh b/update-env.sh index 53625a7..6a5f8ca 100755 --- a/update-env.sh +++ b/update-env.sh @@ -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 + } #------------------------------------------------------------------------------ -- 2.39.5