Repository navigation
Conversation
There are no official Android builds of Python 3.11 or 3.12, so xvenv downloads Chaquopy's builds of these versions, and assembles them into the layout of an official Android release package. xpython now uses its own copy of CPython's Android testbed (from the main branch), rather than the copy included in the Android Python build. For Python versions that don't redirect stdout and stderr to the Android log, a backport of Python 3.13's redirection is added to the testbed.
|
Based on my so-far limited knowledge of xbuild, this makes sense in principle. But what is its use case? The cross-venv approach isn't viable for Briefcase or Chaquopy, because it doesn't work on Windows (chaquo/chaquopy#981 (comment)). And these Python versions aren't supported on Android by cibuildwheel either. That could potentially be changed, but it doesn't seem worth the effort for Python versions that have less than 2 years of lifetime remaining. |
|
@mhsmith The use case is exploring using Briefcase for environment management and installation, which then requires the use of xbuild, but opens up |
Adds Android support for Python 3.11 and 3.12.
There are no official Android builds of Python 3.11 or 3.12.
xvenvnow uses the builds that Chaquopy publishes on Maven Central for these versions (com.chaquo.python:target, 3.11.17-0 and 3.12.15-0). Each one comes as a set of zip files (one per ABI, plus the standard library), not as a single archive.xvenvreassembles them into the layout of an official Android release package:prefix/include, shared libraries intoprefix/lib, and the standard library and extension modules intoprefix/lib/pythonX.Y;_sysconfigdata__android_<triplet>.pyis generated from Chaquopy's shared_sysconfigdata__linux_.py, withMULTIARCH,HOST_GNU_TYPEand the compiler triplet adjusted for the target architecture;android.pyandandroid-env.share added, with the API level taken from the Chaquopy build (24).Assembly happens in a temporary directory inside the cache, so a failure doesn't leave a partial build behind. To support this, downloading is now a per-platform
fetch_archive()built on shareddownload()/download_archive()helpers inxvenv.fetch.xpythonnow ships its own copy of CPython's Android testbed (android.py,android-env.shandtestbed/, fromPlatforms/Androidon CPythonmain) as a resource. The Android testbed is cloned from that copy instead of from the Python build. Provenance is recorded insrc/xpython/resources/android/README.md. Python versions before 3.13 don't redirectsys.stdout/sys.stderrto logcat, so for those the testbed also gets a copy of 3.13's_android_supportmodule, plus a.pthhook that installs the redirection at startup. Without it, the testbed driver would never show any output.Other changes:
platform.AndroidVeron Python < 3.13.android.py testis now run throughsys.executable, because installing from a wheel doesn't keep the script's executable bit.Testing: the unit tests pass on 3.11, 3.12 and 3.14, and the live
xvenvtests (including Android aarch64/x86_64) pass locally on 3.11, 3.12 and 3.14. I haven't been able to run the livexbuild/xpythonAndroid tests locally (no Android SDK), so CI on Linux will be the first run of the testbed on an emulator with 3.11/3.12.PR Checklist:
Assisted-by: Claude Code (Claude Opus 5.5)