From ddb01f602adce5298f28237a1e438c55dfd1fa59 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 3 Jun 2025 16:38:41 +0200 Subject: [PATCH] PYTHON_VERSION="3.12" setup_uv --- install/adventurelog-install.sh | 19 ++++++++----------- install/octoprint-install.sh | 7 +------ install/sabnzbd-install.sh | 2 +- install/wger-install.sh | 3 +-- misc/tools.func | 14 ++++++++++++++ 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/install/adventurelog-install.sh b/install/adventurelog-install.sh index f906b0913..210b96593 100644 --- a/install/adventurelog-install.sh +++ b/install/adventurelog-install.sh @@ -18,12 +18,10 @@ msg_info "Installing Dependencies" $STD apt-get install -y \ gdal-bin \ libgdal-dev \ - git \ - python3-venv \ - python3-pip + git msg_ok "Installed Dependencies" -setup_uv +PYTHON_VERSION="3.12" setup_uv NODE_VERSION="22" NODE_MODULE="pnpm@latest" install_node_and_modules PG_VERSION="16" PG_MODULES="postgis" install_postgresql @@ -80,13 +78,12 @@ DISABLE_REGISTRATION=False EOF cd /opt/adventurelog/backend/server mkdir -p /opt/adventurelog/backend/server/media -$STD uv venv /opt/adventurelog/backend/server/venv -source /opt/adventurelog/backend/server/venv/bin/activate +$STD uv venv --python $UV_PYTHON_VERSION /opt/adventurelog/backend/server/venv $STD uv pip install --upgrade pip $STD uv pip install -r requirements.txt -$STD uv python3 manage.py collectstatic --noinput -$STD uv python3 manage.py migrate -$STD uv python3 manage.py download-countries +$STD uv run python manage.py collectstatic --noinput +$STD uv run python manage.py migrate +$STD uv run python manage.py download-countries cat </opt/adventurelog/frontend/.env PUBLIC_SERVER_URL=http://$LOCAL_IP:8000 BODY_SIZE_LIMIT=Infinity @@ -99,7 +96,7 @@ echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" msg_ok "Installed AdventureLog" msg_info "Setting up Django Admin" -$STD uv python3 /opt/adventurelog/backend/server/manage.py shell </etc/apt/sources.list.d/non-free.list diff --git a/install/wger-install.sh b/install/wger-install.sh index a70f8589b..78e66215d 100644 --- a/install/wger-install.sh +++ b/install/wger-install.sh @@ -20,8 +20,7 @@ $STD apt-get install -y \ libapache2-mod-wsgi-py3 msg_ok "Installed Dependencies" -setup_uv -$STD uv python install +PYTHON_VERSION="3.12" setup_uv NODE_VERSION="22" NODE_MODULE="yarn@latest,sass" install_node_and_modules msg_info "Setting up wger" diff --git a/misc/tools.func b/misc/tools.func index 430ff0275..341a82159 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -1065,6 +1065,20 @@ function setup_uv() { # set path ensure_usr_local_bin_persist msg_ok "uv installed/updated to $LATEST_VERSION" + + if [[ -n "$PYTHON_VERSION" ]]; then + $STD msg_info "Ensuring Python $PYTHON_VERSION is available via uv..." + if ! uv python list | grep -q "cpython-${PYTHON_VERSION}-linux"; then + msg_error "Python version $PYTHON_VERSION not available via uv" + return 1 + fi + if ! uv python list | grep -q "cpython-${PYTHON_VERSION}-linux.*.local/share/uv/python"; then + $STD uv python install "$PYTHON_VERSION" + msg_ok "Installed Python $PYTHON_VERSION via uv" + else + $STD msg_ok "Python $PYTHON_VERSION already installed via uv" + fi + fi } # ------------------------------------------------------------------------------