Skip to content

fix(termux): make Android Termux work end-to-end (fresh install + update)#22901

Merged
teknium1 merged 3 commits into
mainfrom
hermes/hermes-be508f19
May 10, 2026
Merged

fix(termux): make Android Termux work end-to-end (fresh install + update)#22901
teknium1 merged 3 commits into
mainfrom
hermes/hermes-be508f19

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvages #22814 + closes the gap that PR left for fresh Termux installs.

Summary

Termux/Android installs were broken at psutil (platform android is not supported from psutil's setup.py). #22814 fixed only the hermes update path; this PR makes both fresh scripts/install.sh and hermes update work, without the regression risk that #22814's pyproject change would have introduced.

Changes

  • Cherry-picked @adybag14-cyber's two substantive commits from Fix/update psutil android #22814 (authorship preserved):
    • fix(update): prebuild psutil on Termux Android via Linux path shim — adds _install_psutil_android_compat() that downloads the official psutil sdist, patches one line (LINUX = sys.platform.startswith(("linux", "android"))), and installs with --no-build-isolation.
    • fix(update): use termux-all uv fallback path on Termux_load_installable_optional_extras(group=...) plumbing + Termux update path now targets .[termux-all].
  • Added scripts/install_psutil_android.py — standalone version of the patcher so scripts/install.sh can call it for fresh installs.
  • Wired it into scripts/install.sh Termux block: detect sys.platform == 'android' and run the patcher before pip install -e '.[termux-all]'.
  • TODO comments in both copies pointing at upstream restore android support for py3.13+ giampaolo/psutil#2762 — remove both when that ships.

What was dropped from #22814

The pyproject change (psutil>=5.9.0,<8; sys_platform != 'android'). It's a regression: removing psutil from base deps on Android crashes five unguarded import psutil sites at runtime — tools/code_execution_tool.py:1454, tools/tts_tool.py:544, tools/process_registry.py:438,1052, gateway/platforms/whatsapp.py:158. The PR body claimed runtime fallbacks exist; only gateway/status.py and hermes_cli/gateway.py actually have them. With this PR, psutil installs successfully on Android, so all sites keep working.

Validation

  • scripts/run_tests.sh tests/hermes_cli/test_update_autostash.py tests/hermes_cli/test_cmd_update.py tests/test_project_metadata.py → 39/39 pass.
  • E2E patch logic verified: pinned sdist URL is live (493kB), marker line exists exactly once in psutil-7.2.2's _common.py, replacement applies cleanly with no risk of multi-replace.
  • scripts/install_psutil_android.py smoke-tested: --pip, --uv, and default fallback all resolve to the right install command.
  • bash -n scripts/install.sh clean.

Closes #22814 with credit to @adybag14-cyber. Their authorship is preserved on the two cherry-picked commits via rebase-merge.

adybag14-cyber and others added 3 commits May 9, 2026 17:49
The Termux update path (PR #22814) prebuilds psutil from a marker-patched
sdist so 'platform android is not supported' doesn't kill it. The same
psutil setup.py error blocks fresh installs via scripts/install.sh — only
the update path was wired up. Without this, a brand-new Termux user can't
get past the very first 'pip install -e .[termux-all]' call.

- New scripts/install_psutil_android.py — standalone version of the same
  patcher hermes_cli/main.py uses, callable from bash.
- scripts/install.sh detects sys.platform == 'android' and runs the
  patcher before pip install.
- TODO note added to both copies pointing at upstream
  giampaolo/psutil#2762; remove both when that
  ships.

Note: we keep psutil as a base dep on Android (do not adopt the proposed
sys_platform != 'android' marker in pyproject). Removing it would crash
five unguarded 'import psutil' sites at runtime
(tools/code_execution_tool.py, tools/tts_tool.py, tools/process_registry.py
(2x), gateway/platforms/whatsapp.py).
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-be508f19 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 7953 on HEAD, 7953 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4201 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@teknium1 teknium1 merged commit c179bda into main May 10, 2026
14 of 16 checks passed
@teknium1 teknium1 deleted the hermes/hermes-be508f19 branch May 10, 2026 00:53
@teknium1 teknium1 mentioned this pull request May 10, 2026
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants