fix(install): resolve versioned python3-venv package; skip XFCE-only apt packages off XFCE
Newer distros drop the python3-venv transitional package once it no longer resolves to a real pythonX.Y-venv candidate, which crashed sync.py's venv creation with a raw traceback. Prep now resolves the exact versioned package via apt-cache, and skips xfce4-genmon-plugin/plank/blueman on boxes with no xfconf-query so a non-XFCE box doesn't get noisy "unable to locate package" failures for a panel it'll never run. venv_python() also fails with an actionable message instead of an uncaught CalledProcessError. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
6a9786bd03
commit
409e384be0
+23
-3
@@ -33,9 +33,29 @@ if [ "$stage" = "prep" ]; then
|
|||||||
# installed, so it's cheap on an in-place restore. Skipped without apt (non-Debian).
|
# installed, so it's cheap on an in-place restore. Skipped without apt (non-Debian).
|
||||||
if command -v apt-get >/dev/null; then
|
if command -v apt-get >/dev/null; then
|
||||||
echo "Installing system packages..."
|
echo "Installing system packages..."
|
||||||
sudo apt-get install -y --no-install-recommends \
|
|
||||||
git sqlite3 curl python3-venv python3-gi gir1.2-gtk-3.0 \
|
# python3-venv is a transitional package pointing at the real
|
||||||
xfce4-genmon-plugin plank blueman \
|
# pythonX.Y-venv for whatever Python ships by default; on a distro ahead
|
||||||
|
# of that transition it resolves to nothing ("has no installation
|
||||||
|
# candidate") even though a real, version-suffixed package exists.
|
||||||
|
# apt-cache show only succeeds for a package with an actual archive
|
||||||
|
# entry, so it tells the two cases apart without guessing.
|
||||||
|
venv_pkg="python3-venv"
|
||||||
|
if command -v python3 >/dev/null && ! apt-cache show python3-venv >/dev/null 2>&1; then
|
||||||
|
venv_pkg="python3-$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')-venv"
|
||||||
|
fi
|
||||||
|
|
||||||
|
pkgs="git sqlite3 curl $venv_pkg python3-gi gir1.2-gtk-3.0"
|
||||||
|
# XFCE-only cosmetics: only worth attempting where there's an XFCE
|
||||||
|
# session to plug into. Same signal the desktop stage below already
|
||||||
|
# gates on, so a headless/WSL box (no xfconf-query) isn't left with
|
||||||
|
# noisy "unable to locate package" failures for a panel it'll never run.
|
||||||
|
if command -v xfconf-query >/dev/null; then
|
||||||
|
pkgs="$pkgs xfce4-genmon-plugin plank blueman"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC2086 # $pkgs is a deliberate word-split list
|
||||||
|
sudo apt-get install -y --no-install-recommends $pkgs \
|
||||||
|| echo "Warning: some system packages failed — install them manually."
|
|| echo "Warning: some system packages failed — install them manually."
|
||||||
|
|
||||||
# Node.js 20+: Vite needs 20.19+, but Debian/Ubuntu apt ship an EOL Node 18
|
# Node.js 20+: Vite needs 20.19+, but Debian/Ubuntu apt ship an EOL Node 18
|
||||||
|
|||||||
+8
-1
@@ -62,7 +62,14 @@ def venv_python() -> Path:
|
|||||||
venv = ROOT / "Promethean"
|
venv = ROOT / "Promethean"
|
||||||
py = venv / ("Scripts/python.exe" if os.name == "nt" else "bin/python")
|
py = venv / ("Scripts/python.exe" if os.name == "nt" else "bin/python")
|
||||||
if not py.exists():
|
if not py.exists():
|
||||||
subprocess.run([sys.executable, "-m", "venv", str(venv)], check=True)
|
result = subprocess.run([sys.executable, "-m", "venv", str(venv)])
|
||||||
|
if result.returncode:
|
||||||
|
raise SystemExit(
|
||||||
|
"\nvenv creation failed - the Python 'venv' module isn't usable here.\n"
|
||||||
|
"On Debian/Ubuntu this is usually a missing pythonX.Y-venv package; "
|
||||||
|
"check the 'Installing system packages' warning further up, install "
|
||||||
|
"it by hand, then re-run."
|
||||||
|
)
|
||||||
return py
|
return py
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user