Skip to content

Commit

Permalink
Merge pull request #72 from beeware/pillow-11
Browse files Browse the repository at this point in the history
Update recipe for Pillow 11.0.0.
  • Loading branch information
freakboy3742 authored Oct 16, 2024
2 parents a9b99bb + 96b0f53 commit 28c8335
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 28 deletions.
14 changes: 4 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,12 @@ jobs:
fail-fast: false
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
runs-on: [ "macos-latest", "macos-12" ]
runs-on: [ "macos-latest" ]

exclude:
# Don't need to run x86 tests on every Python version
- python-version: "3.9"
runs-on: "macos-12"
- python-version: "3.10"
runs-on: "macos-12"
- python-version: "3.11"
runs-on: "macos-12"
- python-version: "3.13"
runs-on: "macos-12"
runs-on: "macos-13"

steps:
- name: Checkout
Expand All @@ -53,8 +47,8 @@ jobs:
- name: Set up Python
uses: actions/[email protected]
with:
# -dev suffix is a no-op for published releases
python-version: ${{ matrix.python-version }}-dev
python-version: ${{ matrix.python-version }}
allow-prereleases: true

# Initial call to the setup script sets up the environment
- name: Set up Forge
Expand Down
5 changes: 4 additions & 1 deletion recipes/pillow/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package:
name: Pillow
version: 10.4.0
version: 11.0.0

{% if version and version <= (9, 4, 0) %}
patches:
- setup-9.4.0.patch
{% elif version and version <= (10, 4, 0) %}
patches:
- setup-10.4.0.patch
{% else %}
patches:
- setup.patch
Expand Down
66 changes: 66 additions & 0 deletions recipes/pillow/patches/setup-10.4.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Common subdirectories: pillow-10.4.0-orig/Tests and pillow-10.4.0/Tests
Common subdirectories: pillow-10.4.0-orig/_custom_build and pillow-10.4.0/_custom_build
Common subdirectories: pillow-10.4.0-orig/depends and pillow-10.4.0/depends
Common subdirectories: pillow-10.4.0-orig/docs and pillow-10.4.0/docs
diff -u pillow-10.4.0-orig/setup.py pillow-10.4.0/setup.py
--- pillow-10.4.0-orig/setup.py 2024-06-30 23:02:01
+++ pillow-10.4.0/setup.py 2024-09-25 11:15:21
@@ -422,10 +422,22 @@
self.extensions.remove(extension)
break

- def get_macos_sdk_path(self):
+ def get_apple_sdk_path(self):
try:
+ sdk = {
+ ("ios", False): ["--sdk", "iphoneos"],
+ ("ios", True): ["--sdk", "iphonesimulator"],
+ ("tvos", False): ["--sdk", "appletvos"],
+ ("tvos", True): ["--sdk", "appletvsimulator"],
+ ("watchos", False): ["--sdk", "watchos"],
+ ("watchos", True): ["--sdk", "watchsimulator"],
+ ("darwin", False): [],
+ }[
+ sys.platform,
+ getattr(sys.implementation, "_multiarch", "").endswith("simulator"),
+ ]
sdk_path = (
- subprocess.check_output(["xcrun", "--show-sdk-path"])
+ subprocess.check_output(["xcrun", "--show-sdk-path"] + sdk)
.strip()
.decode("latin1")
)
@@ -580,13 +592,18 @@
_add_directory(library_dirs, "/usr/X11/lib")
_add_directory(include_dirs, "/usr/X11/include")

- sdk_path = self.get_macos_sdk_path()
+ sdk_path = self.get_apple_sdk_path()
if sdk_path:
_add_directory(library_dirs, os.path.join(sdk_path, "usr", "lib"))
_add_directory(include_dirs, os.path.join(sdk_path, "usr", "include"))

for extension in self.extensions:
extension.extra_compile_args = ["-Wno-nullability-completeness"]
+ elif sys.platform in {"ios", "tvos", "watchos"}:
+ sdk_path = self.get_apple_sdk_path()
+ if sdk_path:
+ _add_directory(library_dirs, os.path.join(sdk_path, "usr", "lib"))
+ _add_directory(include_dirs, os.path.join(sdk_path, "usr", "include"))
elif (
sys.platform.startswith("linux")
or sys.platform.startswith("gnu")
@@ -618,7 +635,10 @@
# FIXME: check /opt/stuff directories here?

# standard locations
- if not self.disable_platform_guessing:
+ # The standard locations aren't standard on iOS et al.
+ if not (
+ self.disable_platform_guessing or sys.platform in {"ios", "tvos", "watchos"}
+ ):
_add_directory(library_dirs, "/usr/local/lib")
_add_directory(include_dirs, "/usr/local/include")

Common subdirectories: pillow-10.4.0-orig/src and pillow-10.4.0/src
Common subdirectories: pillow-10.4.0-orig/winbuild and pillow-10.4.0/winbuild
23 changes: 8 additions & 15 deletions recipes/pillow/patches/setup.patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
Common subdirectories: pillow-10.4.0-orig/Tests and pillow-10.4.0/Tests
Common subdirectories: pillow-10.4.0-orig/_custom_build and pillow-10.4.0/_custom_build
Common subdirectories: pillow-10.4.0-orig/depends and pillow-10.4.0/depends
Common subdirectories: pillow-10.4.0-orig/docs and pillow-10.4.0/docs
diff -u pillow-10.4.0-orig/setup.py pillow-10.4.0/setup.py
--- pillow-10.4.0-orig/setup.py 2024-06-30 23:02:01
+++ pillow-10.4.0/setup.py 2024-09-25 11:15:21
@@ -422,10 +422,22 @@
diff -ur pillow-11.0.0-orig/setup.py pillow-11.0.0/setup.py
--- pillow-11.0.0-orig/setup.py 2024-10-15 13:58:32
+++ pillow-11.0.0/setup.py 2024-10-17 06:56:00
@@ -445,10 +445,22 @@
self.extensions.remove(extension)
break

- def get_macos_sdk_path(self):
+ def get_apple_sdk_path(self):
- def get_macos_sdk_path(self) -> str | None:
+ def get_apple_sdk_path(self) -> str | None:
try:
+ sdk = {
+ ("ios", False): ["--sdk", "iphoneos"],
Expand All @@ -30,7 +26,7 @@ diff -u pillow-10.4.0-orig/setup.py pillow-10.4.0/setup.py
.strip()
.decode("latin1")
)
@@ -580,13 +592,18 @@
@@ -606,13 +618,18 @@
_add_directory(library_dirs, "/usr/X11/lib")
_add_directory(include_dirs, "/usr/X11/include")

Expand All @@ -50,7 +46,7 @@ diff -u pillow-10.4.0-orig/setup.py pillow-10.4.0/setup.py
elif (
sys.platform.startswith("linux")
or sys.platform.startswith("gnu")
@@ -618,7 +635,10 @@
@@ -644,7 +661,10 @@
# FIXME: check /opt/stuff directories here?

# standard locations
Expand All @@ -61,6 +57,3 @@ diff -u pillow-10.4.0-orig/setup.py pillow-10.4.0/setup.py
+ ):
_add_directory(library_dirs, "/usr/local/lib")
_add_directory(include_dirs, "/usr/local/include")

Common subdirectories: pillow-10.4.0-orig/src and pillow-10.4.0/src
Common subdirectories: pillow-10.4.0-orig/winbuild and pillow-10.4.0/winbuild
4 changes: 2 additions & 2 deletions setup-iOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ if [ -z "$PYTHON_APPLE_SUPPORT" ]; then
3.9) SUPPORT_REVISION=14 ;;
3.10) SUPPORT_REVISION=10 ;;
3.11) SUPPORT_REVISION=5 ;;
3.12) SUPPORT_REVISION=4 ;;
3.13) SUPPORT_REVISION=1 ;;
3.12) SUPPORT_REVISION=5 ;;
3.13) SUPPORT_REVISION=2 ;;
*)
echo "No default support revision for $PYTHON_VER is known; it must be specified manually"
return
Expand Down

0 comments on commit 28c8335

Please sign in to comment.