From 745844f72141e434b4ac18b21a95fc305fb100c3 Mon Sep 17 00:00:00 2001 From: Cobra Date: Thu, 11 Jun 2026 09:37:02 -0400 Subject: [PATCH] install.sh: skip pip when requests is already system-wide PEP 668 Debian 13 systems error out on 'pip install --user'. Runtime only needs requests; pytest+requests-mock are test-only. Detect the runtime dep first and fall back to pip only when missing. --- install.sh | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) mode change 100644 => 100755 install.sh diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index 956f8a7..6b503d5 --- a/install.sh +++ b/install.sh @@ -19,15 +19,20 @@ if mountpoint -q "$HOME/pCloudDrive" 2>/dev/null; then mkdir -p "$PCLOUD_TARGET" fi -# Install dependencies -echo "Installing dependencies..." -if ! pip install --user requests requests-mock pytest 2>&1 | tail -5; then - echo "ERROR: pip install --user failed (PEP 668 externally-managed environment?)." - echo "To install in a virtualenv instead, run:" - echo " python3 -m venv ~/tools/coe-mirror/.venv" - echo " source ~/tools/coe-mirror/.venv/bin/activate" - echo " pip install requests requests-mock pytest" - exit 1 +# Install runtime dependency (requests) if missing. Dev deps (pytest, requests-mock) +# are only needed by the test suite — install them separately in a venv if you plan to test. +if python3 -c "import requests" 2>/dev/null; then + echo "Runtime dep 'requests' already importable system-wide; skipping pip install." +else + echo "Installing runtime dependency: requests" + if ! pip install --user requests 2>&1 | tail -5; then + echo "ERROR: pip install --user failed (PEP 668 externally-managed environment?)." + echo "To install in a virtualenv instead:" + echo " python3 -m venv $TOOL_DIR/.venv" + echo " $TOOL_DIR/.venv/bin/pip install requests" + echo " # then edit systemd/coe-mirror.service ExecStart to point at the venv python" + exit 1 + fi fi # Copy unit files