Repository navigation
Add support for Android #10233
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 our terms of service and privacy 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?
Add support for Android #10233
Changes from all commits
2364fba
622b736
7c6b487
264f972
3cafaec
6d720b9
f77be13
e7619c4
3cd6402
ae5282c
efc79f0
96ac6cc
eb9a43e
1bbc4d3
03d6d21
6bd96f4
374beb5
e04ee37
25d534c
cabe03c
9019fd1
2c11ab8
a696541
22c1120
21b084a
e1aca96
b75d596
6c4a495
02b59e6
46db25d
f252f89
8781b7c
d2aa30c
6a92ebb
c604345
f2ba2dc
322f146
2792e6a
63ae95c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| --- Makefile 2019-07-13 18:50:05 | ||
| +++ Makefile 2026-10-19 19:45:39 | ||
| @@ -15,13 +15,14 @@ | ||
| SHELL=/bin/sh | ||
|
|
||
| # To assist in cross-compiling | ||
| -CC=gcc | ||
| -AR=ar | ||
| -RANLIB=ranlib | ||
| -LDFLAGS= | ||
| +# Pillow: changed = to ?= or += to allow environment variables to take effect | ||
| +CC?=gcc | ||
| +AR?=ar | ||
| +RANLIB?=ranlib | ||
| +LDFLAGS+= | ||
|
|
||
| BIGFILES=-D_FILE_OFFSET_BITS=64 | ||
| -CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) | ||
| +CFLAGS+=-Wall -Winline -O2 -g $(BIGFILES) | ||
|
|
||
| # Where you want it installed when you do 'make install' | ||
| PREFIX=/usr/local | ||
| --- Makefile-libbz2_so 2019-07-13 18:50:05 | ||
| +++ Makefile-libbz2_so 2026-10-19 19:45:31 | ||
| @@ -22,9 +22,10 @@ | ||
|
|
||
|
|
||
| SHELL=/bin/sh | ||
| -CC=gcc | ||
| +# Pillow: changed = to ?= or += to allow environment variables to take effect | ||
| +CC?=gcc | ||
| BIGFILES=-D_FILE_OFFSET_BITS=64 | ||
| -CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES) | ||
| +CFLAGS+=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES) | ||
|
|
||
| OBJS= blocksort.o \ | ||
| huffman.o \ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,7 +101,7 @@ dynamic.version = { attr = "PIL.__version__" } | |
| [tool.cibuildwheel] | ||
| 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" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. |
||
| test-command = "cd {project} && .github/workflows/wheels-test.sh" | ||
| test-requires = [ | ||
| "numpy", | ||
|
|
@@ -110,36 +110,39 @@ test-extras = "tests" | |
| # Disable platform guessing on macOS to avoid picking up Homebrew etc. | ||
| macos.config-settings = "raqm=enable raqm=vendor fribidi=vendor imagequant=disable platform-guessing=disable" | ||
| # Isolate macOS build environment from Homebrew etc. | ||
| macos.environment.PATH = """\ | ||
| $(pwd)/build/deps/darwin/bin:$(dirname $(which python3)):/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin\ | ||
| """ | ||
| # Disable platform guessing on iOS, and disable raqm (since there won't be a | ||
| macos.environment.PATH = "$(dirname $(which python3)):/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin" | ||
| # Windows uses build_dep_all.cmd instead of wheels-dependencies.sh. | ||
| windows.before-build = "" | ||
| # Tell auditwheel where to find dependencies. | ||
| android.environment.AUDITWHEEL_LD_LIBRARY_PATH = "$(pwd)/build/deps/current/prefix/lib" | ||
|
|
||
| # Settings for mobile platforms | ||
| [[tool.cibuildwheel.overrides]] | ||
| select = [ "*-android_*", "*-ios_*" ] | ||
| # Disable platform guessing, and disable raqm (since there won't be a | ||
| # vendor version, and we can't distribute it due to licensing) | ||
| ios.config-settings = "raqm=disable imagequant=disable platform-guessing=disable" | ||
| # iOS needs to be given a specific pytest invocation and list of test sources. | ||
| ios.test-command = [ | ||
| "python -m selftest", | ||
| "python -m pytest -vv -x -W always checks/check_wheel.py Tests", | ||
| ] | ||
| # There's no numpy wheel for iOS (yet...) | ||
| ios.test-requires = [] | ||
| ios.test-sources = [ | ||
| config-settings = "raqm=disable imagequant=disable platform-guessing=disable" | ||
| # Mobile platforms only support Python test-commands, not shell scripts. | ||
| test-command = "python -m wheels_test" | ||
| test-sources = [ | ||
| "checks", | ||
| "Tests", | ||
| "selftest.py", | ||
| "wheels_test.py", | ||
| ] | ||
| overrides = [ | ||
| # iOS environment is isolated by cibuildwheel, but needs the dependencies | ||
| { select = "*_iphoneos", environment.PATH = "$(pwd)/build/deps/iphoneos/bin:$PATH" }, | ||
| # iOS simulator environment is isolated by cibuildwheel, but needs the dependencies | ||
| { select = "*_iphonesimulator", environment.PATH = "$(pwd)/build/deps/iphonesimulator/bin:$PATH" }, | ||
| { select = "*-win32", test-requires = [] }, | ||
| # NumPy does not yet have PyPy 3.12 wheels | ||
| { select = "pp312*", test-requires = [] }, | ||
| xbuild-tools = [] | ||
|
|
||
| [[tool.cibuildwheel.overrides]] | ||
| select = [ | ||
| # NumPy does not have wheels for these platforms or Python versions. | ||
| "*-android_*", | ||
| "*-ios_*", | ||
| "*-win32", | ||
| "pp312*", | ||
| # NumPy's PyPy 3.11 wheels fail to import on PyPy 3.11 v8.0.0 for Windows | ||
| { select = "pp311-win_amd64", test-requires = [] }, | ||
| "pp311-win_amd64", | ||
| ] | ||
| xbuild-tools = [] | ||
| test-requires = [] | ||
|
|
||
| [tool.black] | ||
| exclude = "wheels/multibuild" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import runpy | ||
| import sys | ||
|
|
||
|
|
||
| def run_module(mod_name, *args): | ||
| old_args = sys.argv[1:] | ||
| sys.argv[1:] = args | ||
| try: | ||
| runpy.run_module(mod_name, run_name="__main__", alter_sys=True) | ||
| except SystemExit as e: | ||
| if e.code not in {0, None}: | ||
| raise | ||
| finally: | ||
| sys.argv[1:] = old_args | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| run_module("selftest") | ||
|
|
||
| pytest_args = ["pytest", "-vv", "-x"] | ||
| run_module(*pytest_args, "checks/check_wheel.py") | ||
|
|
||
| # Mobile platforms don't support multiple processes. | ||
| if sys.platform not in ["android", "ios"]: | ||
| pytest_args += ["--numprocesses=logical", "--dist=worksteal"] | ||
| run_module(*pytest_args, "Tests") |
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.
Should this mention that it doesn't build threaded versions?