fix(update): use [termux] extras group on Android

`hermes update` always installs `.[all]`, which pulls in heavy
C-extension packages (faster-whisper, discord.py[voice], mautrix)
that require source compilation on ARM. On a Pixel 8a this hangs
pip for 30+ minutes before eventually failing.

The install scripts (setup-hermes.sh, scripts/install.sh) already
detect Termux and use `.[termux]` + constraints-termux.txt, but the
Python update path in _install_python_dependencies_with_optional_fallback
was never wired up.

This commit reuses the existing hermes_constants.is_termux() to select
the right extras group and constraint file at update time.
This commit is contained in:
Alex Maksimchuk 2026-04-15 08:23:19 -05:00
parent 722331a57d
commit 022036b0aa

View file

@ -3572,10 +3572,24 @@ def _install_python_dependencies_with_optional_fallback(
*,
env: dict[str, str] | None = None,
) -> None:
"""Install base deps plus as many optional extras as the environment supports."""
"""Install base deps plus as many optional extras as the environment supports.
On Termux/Android, uses the ``[termux]`` extras group and
``constraints-termux.txt`` instead of ``[all]`` to avoid pulling in
heavy C-extension packages (voice, matrix, messaging) that require
source compilation on ARM and can hang for 30+ minutes.
"""
from hermes_constants import is_termux as _is_termux
extras_group = "termux" if _is_termux() else "all"
install_args = ["install", "-e", f".[{extras_group}]", "--quiet"]
if _is_termux():
constraints = PROJECT_ROOT / "constraints-termux.txt"
if constraints.exists():
install_args += ["-c", str(constraints)]
try:
subprocess.run(
install_cmd_prefix + ["install", "-e", ".[all]", "--quiet"],
install_cmd_prefix + install_args,
cwd=PROJECT_ROOT,
check=True,
env=env,