Repository navigation
Add support for Android - #10233
Add support for Android#10233mhsmith wants to merge 35 commits into
Conversation
|
Hi. Could you let me know - what was your thinking behind creating this as a draft? You could simply run our CI in your own fork and inspect the results there. Or do you think this is close to being finished, and are hoping for support? |
Sorry, I didn't realize the project required CI approval for new contributors. I'll work on a different branch on my own fork, and update the PR once it's ready for review, which should be within the next few days. |
…ls-dependencies.sh
|
This PR is now ready for review. I've updated the description above. |
|
Is the bzip2 patch intended to be permanent? It would be ideal if the functionality could one day be added upstream. |
|
A fix was already submitted to the project a few years ago, but it doesn't look like it got any response. bzip2 is a very inactive project which hasn't made a release since 2019, so I think we'll have to keep the patch until that changes. |
|
I see the next release is planned for the first week in January; do you think we could get this merged in time for then? Let me know if there's anything that needs more explanation. |
|
Unfortunately, this is a point in time where the amount of issues, PRs and security advisories are overwhelming. So I'm not very optimistic. If you would like to try and move this forward, then the best move might be to request a review from freakboy3742. He was the one who added Pillow iOS support in #9030, and since you're changing some of that code, his approval would be encouraging. |
|
Thanks; I've mentioned this to @freakboy3742 and he says he'll take a look at it. |
freakboy3742
left a comment
There was a problem hiding this comment.
For the most part, this makes sense. I can only spot a couple of issues, which I've flagged inline:
- Duplication of LICENCE collection by moving the wheel script to
before-build oss-fuzzcompatibliity- iOS wheels no longer include XCB - as noted, this isn't really an issue, but it's a notable change
- Overwriting PKG_CONFIG_PATH on macOS in setup.py
- The BZip2 patch allowing environment CC etc to propegate
One issue that I didn't flag inline - The current symlink means that it's no longer possible to run builds in parallel on the same machine. I doubt that's a dealbreaker, but it's worth noting as a change. On the upside, it does allow building multiple architectures in a single build, which the previous script didn't - CIBW_ARCHS had to be set to a single value.
Regarding the LICENSE issue:
The minimal fix would be to split wheel-dependencies.sh into the before-build wheel dependency part, and the before-all license collation part.
However - my take would be that the current approach isn't right anyway, because running a build modifies a file that is CI-controlled. Even with the existing build-all setup, running a build twice in the same folder will have the same effect as this PR.
I'd suggest that the better approach here would be to either:
- Make better use of the PEP 639
license-filesdefinition and include each of the dependency license files separately. That entirely removes the need for the license collation step. - Write the dependency licenses into a file other than
LICENSEthat isn't under version control, and re-create it on every build, then include that file inlicense-files. The downside to this is that there will be file listed inlicense-filesthat won't exist until a build is done. - Write all the license files into
build/LICENSE, and pointlicense-filesat that file. Again, this means the contents oflicense-fileswon't exist unless you do a build.
For my money, option (1) is the better alternative; but that's ultimately a decision for Pillow maintainers to make.
| build-verbosity = 1 | ||
| config-settings = "raqm=enable raqm=vendor fribidi=vendor imagequant=disable" | ||
| before-all = ".github/workflows/wheels-dependencies.sh" | ||
| before-build = ".github/workflows/wheels-dependencies.sh" |
There was a problem hiding this comment.
before-build runs once per build; before-all runs once per job. One of the things that the wheels dependency script does is accumulate licenses in the LICENSES file; so this change results in license text being accumulated multiple times.
There was a problem hiding this comment.
I agree modifying a source-controlled file during the build isn't ideal, but I think fixing that in this PR would touch too many things, because WIndows has its own separate license concatenation script elsewhere in wheels.yml.
Instead, I've added some code to the bottom of wheels-dependencies.sh which detects when the LICENSE file has already been appended, and avoids appending it again. Any other unstaged changes to the file will show an error and stop the build.
|
@radarhere: I've seen several failures like this on manylinux_x86_64 and manylinux_aarch64: Logs:
Is this a known problem? I don't see how it could be caused by this PR. |
|
The Windows x86 failure is unrelated: |
|
@freakboy3742: Please re-review when you have a chance. |
freakboy3742
left a comment
There was a problem hiding this comment.
👍 Thanks for those updates - this all looks good to me.
As with iOS, most of the work was in wheels-dependencies.sh. I've explained the Android-specific changes with comments in the code, but here's a summary of changes that affect other platforms:
wheels-dependencies.sh now runs as a
before-buildscript rather thanbefore-all. This has several advantages:CIBUILDWHEEL_BUILD_IDENTIFIERenvironment variable. This means you can now run cibuildwheel in any of its supported modes, including building multiple architectures in one command, or using--onlywith no environment variables at all.stampfiles and finish quickly without rebuilding anything.To improve consistency between platforms, and reduce clutter in the build directory,
WORKDIRis now set tobuild/deps/os_arch, whereos_archis the second half ofCIBUILDWHEEL_BUILD_IDENTIFIER, e.g.android_x86_64ormacosx_arm64.BUILD_PREFIXis now set to$WORKDIR/prefix. Linux continues to install dependencies to /usr/local as before.Introduced an
IS_LINUXflag, since-z $IS_MACOScan now mean either Linux or Android.For consistency, cmake is now installed from PyPI on all platforms, not just macOS. pkg-config is now also installed from PyPI rather than building it from source.
Factored out the test sequence (selftest, check_wheel, Tests) into a wheels_test script which is shared by all platforms. This was necessary because on Android, cibuildwheel requires
test-commandto be a single Python command.