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.
This commit is contained in:
Regular → Executable
+14
-9
@@ -19,15 +19,20 @@ if mountpoint -q "$HOME/pCloudDrive" 2>/dev/null; then
|
|||||||
mkdir -p "$PCLOUD_TARGET"
|
mkdir -p "$PCLOUD_TARGET"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install dependencies
|
# Install runtime dependency (requests) if missing. Dev deps (pytest, requests-mock)
|
||||||
echo "Installing dependencies..."
|
# are only needed by the test suite — install them separately in a venv if you plan to test.
|
||||||
if ! pip install --user requests requests-mock pytest 2>&1 | tail -5; then
|
if python3 -c "import requests" 2>/dev/null; then
|
||||||
echo "ERROR: pip install --user failed (PEP 668 externally-managed environment?)."
|
echo "Runtime dep 'requests' already importable system-wide; skipping pip install."
|
||||||
echo "To install in a virtualenv instead, run:"
|
else
|
||||||
echo " python3 -m venv ~/tools/coe-mirror/.venv"
|
echo "Installing runtime dependency: requests"
|
||||||
echo " source ~/tools/coe-mirror/.venv/bin/activate"
|
if ! pip install --user requests 2>&1 | tail -5; then
|
||||||
echo " pip install requests requests-mock pytest"
|
echo "ERROR: pip install --user failed (PEP 668 externally-managed environment?)."
|
||||||
exit 1
|
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
|
fi
|
||||||
|
|
||||||
# Copy unit files
|
# Copy unit files
|
||||||
|
|||||||
Reference in New Issue
Block a user