Skip to content

Commit b7298e9

Browse files
committed
Merge branch 'main' into rm-mergify
2 parents 88b7368 + 148e1ac commit b7298e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+318
-383
lines changed

.ci/install.sh

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,21 @@ aptget_update()
1313
return 1
1414
fi
1515
}
16-
if [[ $(uname) != CYGWIN* ]]; then
17-
aptget_update || aptget_update retry || aptget_update retry
18-
fi
16+
aptget_update || aptget_update retry || aptget_update retry
1917

2018
set -e
2119

22-
if [[ $(uname) != CYGWIN* ]]; then
23-
sudo apt-get -qq install libfreetype6-dev liblcms2-dev libtiff-dev python3-tk\
24-
ghostscript libjpeg-turbo8-dev libopenjp2-7-dev\
25-
cmake meson imagemagick libharfbuzz-dev libfribidi-dev\
26-
sway wl-clipboard libopenblas-dev nasm
27-
fi
20+
sudo apt-get -qq install libfreetype6-dev liblcms2-dev libtiff-dev python3-tk\
21+
ghostscript libjpeg-turbo8-dev libopenjp2-7-dev\
22+
cmake meson imagemagick libharfbuzz-dev libfribidi-dev\
23+
sway wl-clipboard libopenblas-dev nasm
2824

2925
python3 -m pip install --upgrade pip
3026
python3 -m pip install --upgrade wheel
3127
python3 -m pip install coverage
3228
python3 -m pip install defusedxml
3329
python3 -m pip install ipython
30+
python3 -m pip install numpy
3431
python3 -m pip install olefile
3532
python3 -m pip install -U pytest
3633
python3 -m pip install -U pytest-cov
@@ -40,36 +37,24 @@ python3 -m pip install pyroma
4037
# fails on beta 3.14 and PyPy
4138
python3 -m pip install --only-binary=:all: pyarrow || true
4239

43-
if [[ $(uname) != CYGWIN* ]]; then
44-
python3 -m pip install numpy
45-
46-
# PyQt6 doesn't support PyPy3
47-
if [[ $GHA_PYTHON_VERSION == 3.* ]]; then
48-
sudo apt-get -qq install libegl1 libxcb-cursor0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxkbcommon-x11-0
49-
# TODO Update condition when pyqt6 supports free-threading
50-
if ! [[ "$PYTHON_GIL" == "0" ]]; then python3 -m pip install pyqt6 ; fi
51-
fi
52-
53-
# Pyroma uses non-isolated build and fails with old setuptools
54-
if [[ $GHA_PYTHON_VERSION == 3.9 ]]; then
55-
# To match pyproject.toml
56-
python3 -m pip install "setuptools>=77"
57-
fi
40+
# PyQt6 doesn't support PyPy3
41+
if [[ $GHA_PYTHON_VERSION == 3.* ]]; then
42+
sudo apt-get -qq install libegl1 libxcb-cursor0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxkbcommon-x11-0
43+
# TODO Update condition when pyqt6 supports free-threading
44+
if ! [[ "$PYTHON_GIL" == "0" ]]; then python3 -m pip install pyqt6 ; fi
45+
fi
5846

59-
# webp
60-
pushd depends && ./install_webp.sh && popd
47+
# webp
48+
pushd depends && ./install_webp.sh && popd
6149

62-
# libimagequant
63-
pushd depends && ./install_imagequant.sh && popd
50+
# libimagequant
51+
pushd depends && ./install_imagequant.sh && popd
6452

65-
# raqm
66-
pushd depends && ./install_raqm.sh && popd
53+
# raqm
54+
pushd depends && ./install_raqm.sh && popd
6755

68-
# libavif
69-
pushd depends && ./install_libavif.sh && popd
56+
# libavif
57+
pushd depends && ./install_libavif.sh && popd
7058

71-
# extra test images
72-
pushd depends && ./install_extra_test_images.sh && popd
73-
else
74-
cd depends && ./install_extra_test_images.sh && cd ..
75-
fi
59+
# extra test images
60+
pushd depends && ./install_extra_test_images.sh && popd

.github/workflows/test-cygwin.yml

Lines changed: 0 additions & 150 deletions
This file was deleted.

.github/workflows/test-windows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ jobs:
3535
strategy:
3636
fail-fast: false
3737
matrix:
38-
python-version: ["pypy3.11", "3.10", "3.11", "3.12", ">=3.13.5", "3.14"]
38+
python-version: ["pypy3.11", "3.11", "3.12", "3.13", "3.14"]
3939
architecture: ["x64"]
4040
include:
4141
# Test the oldest Python on 32-bit
42-
- { python-version: "3.9", architecture: "x86" }
42+
- { python-version: "3.10", architecture: "x86" }
4343

4444
timeout-minutes: 45
4545

.github/workflows/test.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,17 @@ jobs:
4949
"3.12",
5050
"3.11",
5151
"3.10",
52-
"3.9",
5352
]
5453
include:
55-
- { python-version: "3.11", PYTHONOPTIMIZE: 1, REVERSE: "--reverse" }
56-
- { python-version: "3.10", PYTHONOPTIMIZE: 2 }
54+
- { python-version: "3.12", PYTHONOPTIMIZE: 1, REVERSE: "--reverse" }
55+
- { python-version: "3.11", PYTHONOPTIMIZE: 2 }
5756
# Free-threaded
5857
- { python-version: "3.14t", disable-gil: true }
5958
- { python-version: "3.13t", disable-gil: true }
60-
# M1 only available for 3.10+
61-
- { os: "macos-13", python-version: "3.9" }
59+
# Intel
60+
- { os: "macos-13", python-version: "3.10" }
6261
exclude:
63-
- { os: "macos-latest", python-version: "3.9" }
62+
- { os: "macos-latest", python-version: "3.10" }
6463

6564
runs-on: ${{ matrix.os }}
6665
name: ${{ matrix.os }} Python ${{ matrix.python-version }}

.github/workflows/wheels-dependencies.sh

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -186,51 +186,71 @@ function build_libavif {
186186

187187
python3 -m pip install meson ninja
188188

189-
if [[ "$PLAT" == "x86_64" ]] || [ -n "$SANITIZER" ]; then
189+
if ([[ "$PLAT" == "x86_64" ]] && [[ -z "$IOS_SDK" ]]) || [ -n "$SANITIZER" ]; then
190190
build_simple nasm 2.16.03 https://www.nasm.us/pub/nasm/releasebuilds/2.16.03
191191
fi
192192

193193
local build_type=MinSizeRel
194+
local build_shared=ON
194195
local lto=ON
195196

196197
local libavif_cmake_flags
197198

198-
if [ -n "$IS_MACOS" ]; then
199+
if [[ -n "$IS_MACOS" ]]; then
199200
lto=OFF
200201
libavif_cmake_flags=(
201202
-DCMAKE_C_FLAGS_MINSIZEREL="-Oz -DNDEBUG -flto" \
202203
-DCMAKE_CXX_FLAGS_MINSIZEREL="-Oz -DNDEBUG -flto" \
203204
-DCMAKE_SHARED_LINKER_FLAGS_INIT="-Wl,-S,-x,-dead_strip_dylibs" \
204205
)
206+
if [[ -n "$IOS_SDK" ]]; then
207+
build_shared=OFF
208+
fi
205209
else
206210
if [[ "$MB_ML_VER" == 2014 ]] && [[ "$PLAT" == "x86_64" ]]; then
207211
build_type=Release
208212
fi
209213
libavif_cmake_flags=(-DCMAKE_SHARED_LINKER_FLAGS_INIT="-Wl,--strip-all,-z,relro,-z,now")
210214
fi
215+
if [[ -n "$IOS_SDK" ]] && [[ "$PLAT" == "x86_64" ]]; then
216+
libavif_cmake_flags+=(-DAOM_TARGET_CPU=generic)
217+
else
218+
libavif_cmake_flags+=(
219+
-DAVIF_CODEC_AOM_DECODE=OFF \
220+
-DAVIF_CODEC_DAV1D=LOCAL
221+
)
222+
fi
211223

212224
local out_dir=$(fetch_unpack https://github.com/AOMediaCodec/libavif/archive/refs/tags/v$LIBAVIF_VERSION.tar.gz libavif-$LIBAVIF_VERSION.tar.gz)
225+
213226
# CONFIG_AV1_HIGHBITDEPTH=0 is a flag for libaom (included as a subproject
214227
# of libavif) that disables support for encoding high bit depth images.
215228
(cd $out_dir \
216229
&& cmake \
217230
-DCMAKE_INSTALL_PREFIX=$BUILD_PREFIX \
218231
-DCMAKE_INSTALL_LIBDIR=$BUILD_PREFIX/lib \
219232
-DCMAKE_INSTALL_NAME_DIR=$BUILD_PREFIX/lib \
220-
-DBUILD_SHARED_LIBS=ON \
233+
-DBUILD_SHARED_LIBS=$build_shared \
221234
-DAVIF_LIBSHARPYUV=LOCAL \
222235
-DAVIF_LIBYUV=LOCAL \
223236
-DAVIF_CODEC_AOM=LOCAL \
224237
-DCONFIG_AV1_HIGHBITDEPTH=0 \
225-
-DAVIF_CODEC_AOM_DECODE=OFF \
226-
-DAVIF_CODEC_DAV1D=LOCAL \
227238
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=$lto \
228239
-DCMAKE_C_VISIBILITY_PRESET=hidden \
229240
-DCMAKE_CXX_VISIBILITY_PRESET=hidden \
230241
-DCMAKE_BUILD_TYPE=$build_type \
231242
"${libavif_cmake_flags[@]}" \
232-
. \
233-
&& make install)
243+
$HOST_CMAKE_FLAGS . )
244+
245+
if [[ -n "$IOS_SDK" ]]; then
246+
# libavif's CMake configuration generates a meson cross file... but it
247+
# doesn't work for iOS cross-compilation. Copy in Pillow-generated
248+
# meson-cross config to replace the cmake-generated version.
249+
cp $WORKDIR/meson-cross.txt $out_dir/crossfile-apple.meson
250+
fi
251+
252+
(cd $out_dir && make install)
253+
234254
touch libavif-stamp
235255
}
236256

@@ -268,10 +288,7 @@ function build {
268288
build_tiff
269289
fi
270290

271-
if [[ -z "$IOS_SDK" ]]; then
272-
# Short term workaround; don't build libavif on iOS
273-
build_libavif
274-
fi
291+
build_libavif
275292
build_libpng
276293
build_lcms2
277294
build_openjpeg

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ As of 2019, Pillow development is
3636
<a href="https://github.com/python-pillow/Pillow/actions/workflows/test-mingw.yml"><img
3737
alt="GitHub Actions build status (Test MinGW)"
3838
src="https://github.com/python-pillow/Pillow/workflows/Test%20MinGW/badge.svg"></a>
39-
<a href="https://github.com/python-pillow/Pillow/actions/workflows/test-cygwin.yml"><img
40-
alt="GitHub Actions build status (Test Cygwin)"
41-
src="https://github.com/python-pillow/Pillow/workflows/Test%20Cygwin/badge.svg"></a>
4239
<a href="https://github.com/python-pillow/Pillow/actions/workflows/test-docker.yml"><img
4340
alt="GitHub Actions build status (Test Docker)"
4441
src="https://github.com/python-pillow/Pillow/workflows/Test%20Docker/badge.svg"></a>

Tests/helper.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,20 @@
1010
import subprocess
1111
import sys
1212
import tempfile
13-
from collections.abc import Sequence
1413
from functools import lru_cache
1514
from io import BytesIO
16-
from pathlib import Path
17-
from typing import Any, Callable
1815

1916
import pytest
2017
from packaging.version import parse as parse_version
2118

2219
from PIL import Image, ImageFile, ImageMath, features
2320

21+
TYPE_CHECKING = False
22+
if TYPE_CHECKING:
23+
from collections.abc import Callable, Sequence
24+
from pathlib import Path
25+
from typing import Any
26+
2427
logger = logging.getLogger(__name__)
2528

2629
uploader = None

0 commit comments

Comments
 (0)