bootstrap: auto-remove interfering .pths when --fix-urllib3; prefer /usr/local/bin for root; fix VENV warning
Some checks failed
smoke-mm / Install & smoke test mm --help (push) Has been cancelled

This commit is contained in:
nose
2025-12-24 02:49:05 -08:00
parent 32494a97ac
commit 983cb193cd

View File

@@ -103,9 +103,12 @@ PY
echo "Found the following potentially interfering .pth files:" >&2 echo "Found the following potentially interfering .pth files:" >&2
for p in "${pths[@]}"; do echo " - $p" >&2; done for p in "${pths[@]}"; do echo " - $p" >&2; done
if [[ "$REMOVE_PTH" == "true" ]]; then if [[ "$REMOVE_PTH" == "true" || "$FIX_URLLIB3" == "true" ]]; then
echo "Removing .pth files as requested..." >&2 echo "Removing .pth files (automatic removal due to --fix-urllib3)..." >&2
for p in "${pths[@]}"; do rm -f "$p"; done for p in "${pths[@]}"; do
rm -f "$p"
echo "Removed: $p" >&2
done
else else
if [[ "$QUIET" == "true" ]]; then if [[ "$QUIET" == "true" ]]; then
echo "Detected interfering .pth files but cannot prompt in quiet mode. Re-run with --remove-pth to remove them automatically." >&2 echo "Detected interfering .pth files but cannot prompt in quiet mode. Re-run with --remove-pth to remove them automatically." >&2
@@ -116,7 +119,10 @@ PY
echo "User declined to remove .pth files. Aborting." >&2 echo "User declined to remove .pth files. Aborting." >&2
return 3 return 3
fi fi
for p in "${pths[@]}"; do rm -f "$p"; done for p in "${pths[@]}"; do
rm -f "$p"
echo "Removed: $p" >&2
done
fi fi
# Re-run reinstall & verify # Re-run reinstall & verify
@@ -396,6 +402,10 @@ fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO="$(cd "$SCRIPT_DIR/.." && pwd)" REPO="$(cd "$SCRIPT_DIR/.." && pwd)"
USER_BIN="${XDG_BIN_HOME:-$HOME/.local/bin}" USER_BIN="${XDG_BIN_HOME:-$HOME/.local/bin}"
# If running as root, prefer a system-wide location that is likely on PATH (/usr/local/bin)
if [[ $(id -u) -eq 0 && -w "/usr/local/bin" ]]; then
USER_BIN="/usr/local/bin"
fi
mkdir -p "$USER_BIN" mkdir -p "$USER_BIN"
if [[ -f "$USER_BIN/mm" ]]; then if [[ -f "$USER_BIN/mm" ]]; then
echo "Backing up existing $USER_BIN/mm to $USER_BIN/mm.bak.$(date +%s)" echo "Backing up existing $USER_BIN/mm to $USER_BIN/mm.bak.$(date +%s)"
@@ -419,7 +429,7 @@ chmod +x "$USER_BIN/mm"
if "$USER_BIN/mm" --help >/dev/null 2>&1; then if "$USER_BIN/mm" --help >/dev/null 2>&1; then
echo "Global 'mm' launcher verified: $USER_BIN/mm runs correctly." echo "Global 'mm' launcher verified: $USER_BIN/mm runs correctly."
else else
echo "Warning: Global 'mm' launcher failed to run in this shell. Ensure $USER_BIN is on your PATH and the venv is installed; try: $VENV/bin/python -m medeia_macina.cli_entry --help" >&2 echo "Warning: Global 'mm' launcher failed to run in this shell. Ensure $USER_BIN is on your PATH and the venv is installed; try: $VENV_PY -m medeia_macina.cli_entry --help" >&2
fi fi
# Ensure the user's bin is on PATH for future sessions by adding to ~/.profile if needed # Ensure the user's bin is on PATH for future sessions by adding to ~/.profile if needed