fix(termux): make Android Termux work end-to-end (fresh install + update)#22901
Merged
Conversation
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).
Contributor
🔎 Lint report:
|
10 tasks
This was referenced May 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Salvages #22814 + closes the gap that PR left for fresh Termux installs.
Summary
Termux/Android installs were broken at psutil (
platform android is not supportedfrom psutil's setup.py). #22814 fixed only thehermes updatepath; this PR makes both freshscripts/install.shandhermes updatework, without the regression risk that #22814's pyproject change would have introduced.Changes
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].scripts/install_psutil_android.py— standalone version of the patcher soscripts/install.shcan call it for fresh installs.scripts/install.shTermux block: detectsys.platform == 'android'and run the patcher beforepip install -e '.[termux-all]'.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 unguardedimport psutilsites 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; onlygateway/status.pyandhermes_cli/gateway.pyactually 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._common.py, replacement applies cleanly with no risk of multi-replace.scripts/install_psutil_android.pysmoke-tested:--pip,--uv, and default fallback all resolve to the right install command.bash -n scripts/install.shclean.Closes #22814 with credit to @adybag14-cyber. Their authorship is preserved on the two cherry-picked commits via rebase-merge.