Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-131531: android.py enhancements to support cibuildwheel#132870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Android/android.py Outdated
f"PREFIX={prefix}; " | ||
f". {env_script}; " | ||
f"export", | ||
check=True, shell=True, capture_output=True, text=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Is there a way to avoidshell=True
? We should try to avoid it, especially as code inpython/cpython
is prominent. Also, prefer 'encoding' to 'text':
check=True,shell=True,capture_output=True,text=True, | |
check=True,shell=True,capture_output=True,encoding='utf-8', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
In this case the whole point of the code is to run a shell script and determine which environment variables it sets, soshell=True
is unavoidable. However, the script is entirely under our control – it's in the repository right next to this file.
Also, prefer 'encoding' to 'text'
Thanks, fixed.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
@freakboy3742: Please review this PR, but don't actually merge it yet, as there may be some further updates depending on what happens on the cibuildwheel PR. |
!buildbot android |
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The broad strokes of this (especially the modifications to kick off an external test suite) make sense; a couple of questions inline about specific decisions/changes.
There's also the issue with the CI failures; not sure how many of those are transient issues caused by the state of main, and how many are caused by changes in this PR - at least one of the errors seems to be related to ctypes availability.
env_script = ANDROID_DIR / "android-env.sh" | ||
env_output = subprocess.run( | ||
f"set -eu; " | ||
f"export HOST={host}; " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Is there a reason this has become a full export?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
HOST
is a somewhat standardized way of indicating cross-compilation, e.g. it's used by conda-build. So it makes sense to expose it to the build system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'm also using it in the cibuildwheel PR to setsys.implementation._multiarch
in the cross-compilation environment.
Android/android.py Outdated
# when building third-party extension modules, so pass them via the | ||
# NODIST environment variables. | ||
host_env = android_env(host) | ||
for name in ["CFLAGS", "CXXFLAGS", "LDFLAGS"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Why are these needed for the testbed environment? Is this script being used to drive cibuildwheel?
Or - I guess - why are they needed now to support compilation when they weren't required previously?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This section of the script is only directly used when building Python itself. This PR doesn't change the flags, it only moves the flags which contain build-time paths from the...FLAGS
variables (which are exposed by sysconfig for the purpose of building packages) to the...FLAGS_NODIST
variables (which are only used when building Python). This approach is recommended inPython's build documentation.
This may be unnecessary for cibuildwheel, because it contains code to rewrite any paths in the sysconfigdata. But cibuildwheel isn't the only context in which packages could be built – e.g. we may also see "native" (non-cross) compilation on Termux.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
OK, I've reverted this now, because the NODIST variables weren't being used by the configure script when searching for libraries such as libffi. This is what caused the previous failure to build ctypes.
I didn't see the failure locally because configure was able to find the libraries using pkg-config. But that isn't installed on the buildbot machine because it isn't part of the macOS command-line tools, it's from Homebrew. And I'd rather not add a dependency on that.
As I said in my previous comment, this doesn't matter for cibuildwheel. And it doesn't really matter for Termux either, because the filesystem layout on Android is so different, that there's no chance of the build-time paths actually existing, so they'll be ignored.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
I think it's caused by this PR – I'll look into it. |
!buildbot android |
This comment was marked as outdated.
This comment was marked as outdated.
!buildbot android |
This comment was marked as outdated.
This comment was marked as outdated.
!buildbot android |
bedevere-bot commentedMay 29, 2025
🤖 New build scheduled with the buildbot fleet by@mhsmith for commit36da007 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F132870%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
mhsmith commentedMay 29, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I have made the requested changes; please review again, and merge and backport if you think it's ready. I'll then put a new 3.13 release package on Maven Central for use by cibuildwheel. |
Thanks for making the requested changes! @freakboy3742: please review the changes made to this pull request. |
Uh oh!
There was an error while loading.Please reload this page.
#131532 added an Android release package format for the use of external tools such as cibuildwheel. This PR adds a number of features to that package to allow third-party wheels to be built and tested against it:
android.py env
command which prints necessary environment variables (CC, CFLAGS, etc.).android.py test
command so it can be used to run any test suite, not only Python's own tests. This involves adding the following options:--site-packages
to copy code into the app--cwd
to copy files into the app's working directory-c
to run a Python statement-m
to run a Python moduleThe corresponding cibuildwheel PR ispypa/cibuildwheel#2349.