Skip to content

fix(termux): emit Android-tagged psutil wheels - #67136

Closed
adybag14-cyber wants to merge 2 commits into
NousResearch:mainfrom
adybag14-cyber:fix/termux-android-wheel-tags
Closed

fix(termux): emit Android-tagged psutil wheels#67136
adybag14-cyber wants to merge 2 commits into
NousResearch:mainfrom
adybag14-cyber:fix/termux-android-wheel-tags

Conversation

@adybag14-cyber

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes the advertised native-Termux python scripts/install_psutil_android.py --uv path, and the shared update helper that uses the same patched psutil source tree.

On Termux/Android with Python 3.11.15 and uv 0.11.29, the current helper successfully patches and compiles psutil 7.2.2, but setuptools emits:

psutil-7.2.2-cp36-abi3-linux_aarch64.whl

uv correctly rejects that Linux wheel for an Android interpreter. Exporting _PYTHON_HOST_PLATFORM=android_... around uv pip is not safe either: it changes the platform uv sees while inspecting Python and fails with Unknown operating system: android_....

This patch writes a package-local [bdist_wheel] plat_name into the extracted psutil sdist instead. That scopes the override to the psutil wheel build and leaves uv's interpreter detection untouched.

The helper now:

  • emits PEP 738-style Android platform tags;
  • defaults to Termux's API 24 build target rather than the phone's runtime API (API 36 on the reproducing device);
  • maps aarch64, 32-bit ARM, x86_64, and x86 machine names to Android ABI names;
  • supports an explicit HERMES_ANDROID_API_LEVEL build-target override;
  • rejects unknown architectures and invalid API levels with a clear installer error.

Related Issue

Related to #44390, which documents the standalone psutil helper, and #5984, which is migrating Hermes-owned installs toward uv-native project flows.

This deliberately does not duplicate:

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • hermes_cli/psutil_android.py
    • adds deterministic Android API/ABI wheel-tag resolution;
    • patches or creates the extracted sdist's [bdist_wheel] configuration;
    • keeps the existing safe extraction and psutil Android source-marker patch;
    • allows an explicit platform tag in tests without mutating process-global build state.
  • tests/hermes_cli/test_psutil_android_wheel_tag.py
    • covers Termux architecture mappings;
    • verifies runtime ANDROID_API_LEVEL=36 does not incorrectly raise the wheel target above API 24;
    • covers the explicit build-target override and validation failures;
    • verifies existing setup.cfg content is preserved;
    • performs a behavior-level bdist_wheel build and asserts the resulting Android-tagged filename.

How to Test

Real-device reproduction environment:

  • Android / native Termux, aarch64
  • Python 3.11.15
  • uv 0.11.29
  • device runtime API 36; Termux interpreter target API 24

Before this patch:

The built wheel `psutil-7.2.2-cp36-abi3-linux_aarch64.whl`
is not compatible with the current Python 3.11 on Android aarch64

The manually corrected wheel that uv accepted was:

psutil-7.2.2-cp36-abi3-android_24_arm64_v8a.whl

Focused automated validation performed in an isolated checkout harness:

PYTHONPATH=. pytest -q tests/hermes_cli/test_psutil_android_wheel_tag.py
# 11 passed

python -m py_compile hermes_cli/psutil_android.py \
  tests/hermes_cli/test_psutil_android_wheel_tag.py
# passed

The pre-existing safe-extraction regression was also exercised beside the new suite in the isolated harness: 12 tests passed total.

Not run in this session: the complete repository suite, ruff, or scripts/check-windows-footguns.py. The requested Devbox and Windows-host executors were unavailable to this conversation, so this PR is opened as a draft for CI and a final native-Termux rerun.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix (two files)
  • I've run pytest tests/ -q and all tests pass — focused regression suite passed; full suite pending CI
  • I've added tests for my changes
  • I've reproduced the failure on my platform: native Termux/Android aarch64

Documentation & Housekeeping

  • Relevant documentation update — N/A; the existing helper interface is unchanged
  • cli-config.yaml.example update — N/A; no config key added
  • CONTRIBUTING.md / AGENTS.md update — N/A; no workflow architecture changed
  • Cross-platform impact considered: the changed helper is only invoked for Android psutil compatibility, and the platform override is package-local
  • Tool descriptions/schemas update — N/A

For New Skills

N/A.

Screenshots / Logs

The relevant native-Termux build and uv rejection/acceptance logs are summarized in How to Test above.

@adybag14-cyber
adybag14-cyber force-pushed the fix/termux-android-wheel-tags branch from 9852f4b to ca0703f Compare July 18, 2026 21:18
@adybag14-cyber
adybag14-cyber marked this pull request as ready for review July 18, 2026 21:24
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have labels Jul 18, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.
Related to #31415, #44390, and #5984: this fixes the separate Android wheel-tag emission path; it is not the Termux guide or broader uv project-flow work.

Copy link
Copy Markdown
Contributor Author

Superseded by #67163, which includes this Android psutil wheel-tag fix plus the complete native-Termux failure chain: supported Python selection, side-by-side Python 3.11 recovery, uv-only venv/install flow, package-scoped Android wheel builds for the other failing sdists, serial Cargo builds, safe index handling, dependency-profile gates, launcher repair, and end-to-end regression tests. Closing this narrower draft so #67163 is the single canonical implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants