From 68277cc929aa5d8a28b8dde9c150ca5c9e23bef3 Mon Sep 17 00:00:00 2001 From: Omid Zamani Date: Fri, 2 Jan 2026 16:50:08 +0100 Subject: [PATCH] fix: reoslve the uv issue --- cmdeploy/src/cmdeploy/cmdeploy.py | 2 +- cmdeploy/src/cmdeploy/deployers.py | 2 +- doc/source/getting_started.rst | 2 +- init.sh | 11 ++++++++++- scripts/build-docs.sh | 2 +- scripts/cmdeploy | 2 +- scripts/initenv.sh | 10 +++++++++- 7 files changed, 24 insertions(+), 7 deletions(-) diff --git a/cmdeploy/src/cmdeploy/cmdeploy.py b/cmdeploy/src/cmdeploy/cmdeploy.py index 7c67bf0a..45f4ce4a 100644 --- a/cmdeploy/src/cmdeploy/cmdeploy.py +++ b/cmdeploy/src/cmdeploy/cmdeploy.py @@ -194,7 +194,7 @@ def test_cmd_options(parser): def test_cmd(args, out): """Run local and online tests for chatmail deployment. - This will automatically pip-install 'deltachat' if it's not available. + This will automatically uv-pip-install 'deltachat' if it's not available. """ x = importlib.util.find_spec("deltachat") diff --git a/cmdeploy/src/cmdeploy/deployers.py b/cmdeploy/src/cmdeploy/deployers.py index ba276da8..5258f4b4 100644 --- a/cmdeploy/src/cmdeploy/deployers.py +++ b/cmdeploy/src/cmdeploy/deployers.py @@ -13,7 +13,7 @@ from pyinfra import facts, host, logger from pyinfra.api import FactBase from pyinfra.facts.files import Sha256File from pyinfra.facts.systemd import SystemdEnabled -from pyinfra.operations import apt, files, pip, server, systemd +from pyinfra.operations import apt, files, server, systemd from cmdeploy.cmdeploy import Out diff --git a/doc/source/getting_started.rst b/doc/source/getting_started.rst index e0ffb619..e5f8100c 100644 --- a/doc/source/getting_started.rst +++ b/doc/source/getting_started.rst @@ -46,7 +46,7 @@ steps. Please substitute it with your own domain. mta-sts.chat.example.org. 3600 IN CNAME chat.example.org. 2. On your local PC, clone the repository and bootstrap the Python - virtualenv. + environment using ``uv``. :: diff --git a/init.sh b/init.sh index 7a7b2117..d754295d 100644 --- a/init.sh +++ b/init.sh @@ -7,11 +7,20 @@ sudo apt update sudo apt install -y git curl wget python3-dev gcc python3 nano sed # 1.1 Install uv +export PATH="$HOME/.local/bin:/root/.local/bin:$PATH" +if ! command -v uv &> /dev/null; then + if [ -f "/root/.local/bin/uv" ]; then + export PATH="/root/.local/bin:$PATH" + elif [ -f "$HOME/.local/bin/uv" ]; then + export PATH="$HOME/.local/bin:$PATH" + fi +fi + if ! command -v uv &> /dev/null; then echo "--- Installing uv ---" curl -LsSf https://astral.sh/uv/install.sh | sh # Ensure uv is in PATH for the current script - export PATH="$HOME/.local/bin:$PATH" + export PATH="$HOME/.local/bin:/root/.local/bin:$PATH" fi # 2. Clone the repository if not already in it diff --git a/scripts/build-docs.sh b/scripts/build-docs.sh index 8a4e5629..a957d4a2 100644 --- a/scripts/build-docs.sh +++ b/scripts/build-docs.sh @@ -3,7 +3,7 @@ # Wrapper for building the docs set -e # Ensure uv is in PATH -export PATH="$HOME/.local/bin:$PATH" +export PATH="$HOME/.local/bin:/root/.local/bin:$PATH" cd doc/ uv run make html diff --git a/scripts/cmdeploy b/scripts/cmdeploy index 379f83a0..1a1a1488 100755 --- a/scripts/cmdeploy +++ b/scripts/cmdeploy @@ -3,6 +3,6 @@ # Wrapper for cmdelpoy to run it in activated virtualenv. set -e # Ensure uv is in PATH -export PATH="$HOME/.local/bin:$PATH" +export PATH="$HOME/.local/bin:/root/.local/bin:$PATH" uv run cmdeploy "$@" diff --git a/scripts/initenv.sh b/scripts/initenv.sh index 6fc3ab4e..7f589396 100755 --- a/scripts/initenv.sh +++ b/scripts/initenv.sh @@ -19,7 +19,15 @@ if command -v lsb_release 2>&1 >/dev/null; then fi # Ensure uv is in PATH -export PATH="$HOME/.local/bin:$PATH" +export PATH="$HOME/.local/bin:/root/.local/bin:$PATH" + +if ! command -v uv &> /dev/null; then + if [ -f "/root/.local/bin/uv" ]; then + export PATH="/root/.local/bin:$PATH" + elif [ -f "$HOME/.local/bin/uv" ]; then + export PATH="$HOME/.local/bin:$PATH" + fi +fi if ! command -v uv &> /dev/null; then echo "uv not found. Please install it first or run init.sh"