Skip to content

Commit a0a1ff1

Browse files
committed
Merge branch 'main' into encoderinfo_frames
2 parents 0bb99e5 + 3a66b1d commit a0a1ff1

File tree

90 files changed

+13047
-465
lines changed

Some content is hidden

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

90 files changed

+13047
-465
lines changed

.ci/requirements-cibw.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cibuildwheel==2.23.3
1+
cibuildwheel==3.0.0

.ci/requirements-mypy.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
mypy==1.16.0
1+
mypy==1.16.1
22
IceSpringPySideStubs-PyQt6
33
IceSpringPySideStubs-PySide6
44
ipython

.github/workflows/test-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
strategy:
3636
fail-fast: false
3737
matrix:
38-
python-version: ["pypy3.11", "pypy3.10", "3.10", "3.11", "3.12", "3.13", "3.14"]
38+
python-version: ["pypy3.11", "pypy3.10", "3.10", "3.11", "3.12", ">=3.13.5", "3.14"]
3939
architecture: ["x64"]
4040
include:
4141
# Test the oldest Python on 32-bit

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
python-version: [
4444
"pypy3.11",
4545
"pypy3.10",
46+
"3.14t",
4647
"3.14",
4748
"3.13t",
4849
"3.13",
@@ -55,6 +56,7 @@ jobs:
5556
- { python-version: "3.11", PYTHONOPTIMIZE: 1, REVERSE: "--reverse" }
5657
- { python-version: "3.10", PYTHONOPTIMIZE: 2 }
5758
# Free-threaded
59+
- { python-version: "3.14t", disable-gil: true }
5860
- { python-version: "3.13t", disable-gil: true }
5961
# M1 only available for 3.10+
6062
- { os: "macos-13", python-version: "3.9" }

.github/workflows/wheels-dependencies.sh

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ ARCHIVE_SDIR=pillow-depends-main
3939
# Package versions for fresh source builds
4040
FREETYPE_VERSION=2.13.3
4141
HARFBUZZ_VERSION=11.2.1
42-
LIBPNG_VERSION=1.6.48
43-
JPEGTURBO_VERSION=3.1.0
42+
LIBPNG_VERSION=1.6.49
43+
JPEGTURBO_VERSION=3.1.1
4444
OPENJPEG_VERSION=2.5.3
4545
XZ_VERSION=5.8.1
4646
TIFF_VERSION=4.7.0
@@ -51,6 +51,7 @@ LIBWEBP_VERSION=1.5.0
5151
BZIP2_VERSION=1.0.8
5252
LIBXCB_VERSION=1.17.0
5353
BROTLI_VERSION=1.1.0
54+
LIBAVIF_VERSION=1.3.0
5455

5556
function build_pkg_config {
5657
if [ -e pkg-config-stamp ]; then return; fi
@@ -98,6 +99,59 @@ function build_harfbuzz {
9899
touch harfbuzz-stamp
99100
}
100101

102+
function build_libavif {
103+
if [ -e libavif-stamp ]; then return; fi
104+
105+
python3 -m pip install meson ninja
106+
107+
if [[ "$PLAT" == "x86_64" ]] || [ -n "$SANITIZER" ]; then
108+
build_simple nasm 2.16.03 https://www.nasm.us/pub/nasm/releasebuilds/2.16.03
109+
fi
110+
111+
local build_type=MinSizeRel
112+
local lto=ON
113+
114+
local libavif_cmake_flags
115+
116+
if [ -n "$IS_MACOS" ]; then
117+
lto=OFF
118+
libavif_cmake_flags=(
119+
-DCMAKE_C_FLAGS_MINSIZEREL="-Oz -DNDEBUG -flto" \
120+
-DCMAKE_CXX_FLAGS_MINSIZEREL="-Oz -DNDEBUG -flto" \
121+
-DCMAKE_SHARED_LINKER_FLAGS_INIT="-Wl,-S,-x,-dead_strip_dylibs" \
122+
)
123+
else
124+
if [[ "$MB_ML_VER" == 2014 ]] && [[ "$PLAT" == "x86_64" ]]; then
125+
build_type=Release
126+
fi
127+
libavif_cmake_flags=(-DCMAKE_SHARED_LINKER_FLAGS_INIT="-Wl,--strip-all,-z,relro,-z,now")
128+
fi
129+
130+
local out_dir=$(fetch_unpack https://github.com/AOMediaCodec/libavif/archive/refs/tags/v$LIBAVIF_VERSION.tar.gz libavif-$LIBAVIF_VERSION.tar.gz)
131+
# CONFIG_AV1_HIGHBITDEPTH=0 is a flag for libaom (included as a subproject
132+
# of libavif) that disables support for encoding high bit depth images.
133+
(cd $out_dir \
134+
&& cmake \
135+
-DCMAKE_INSTALL_PREFIX=$BUILD_PREFIX \
136+
-DCMAKE_INSTALL_LIBDIR=$BUILD_PREFIX/lib \
137+
-DCMAKE_INSTALL_NAME_DIR=$BUILD_PREFIX/lib \
138+
-DBUILD_SHARED_LIBS=ON \
139+
-DAVIF_LIBSHARPYUV=LOCAL \
140+
-DAVIF_LIBYUV=LOCAL \
141+
-DAVIF_CODEC_AOM=LOCAL \
142+
-DCONFIG_AV1_HIGHBITDEPTH=0 \
143+
-DAVIF_CODEC_AOM_DECODE=OFF \
144+
-DAVIF_CODEC_DAV1D=LOCAL \
145+
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=$lto \
146+
-DCMAKE_C_VISIBILITY_PRESET=hidden \
147+
-DCMAKE_CXX_VISIBILITY_PRESET=hidden \
148+
-DCMAKE_BUILD_TYPE=$build_type \
149+
"${libavif_cmake_flags[@]}" \
150+
. \
151+
&& make install)
152+
touch libavif-stamp
153+
}
154+
101155
function build {
102156
build_xz
103157
if [ -z "$IS_ALPINE" ] && [ -z "$SANITIZER" ] && [ -z "$IS_MACOS" ]; then
@@ -132,6 +186,7 @@ function build {
132186
build_tiff
133187
fi
134188

189+
build_libavif
135190
build_libpng
136191
build_lcms2
137192
build_openjpeg

.github/workflows/wheels-test.ps1

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,21 @@ if ("$venv" -like "*\cibw-run-*\pp*-win_amd64\*") {
99
C:\vc_redist.x64.exe /install /quiet /norestart | Out-Null
1010
}
1111
$env:path += ";$pillow\winbuild\build\bin\"
12-
& "$venv\Scripts\activate.ps1"
12+
if (Test-Path $venv\Scripts\pypy.exe) {
13+
$python = "pypy.exe"
14+
} else {
15+
$python = "python.exe"
16+
}
1317
& reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\python.exe" /v "GlobalFlag" /t REG_SZ /d "0x02000000" /f
1418
if ("$venv" -like "*\cibw-run-*-win_amd64\*") {
15-
& python -m pip install numpy
19+
& $venv\Scripts\$python -m pip install numpy
1620
}
1721
cd $pillow
18-
& python -VV
22+
& $venv\Scripts\$python -VV
1923
if (!$?) { exit $LASTEXITCODE }
20-
& python selftest.py
24+
& $venv\Scripts\$python selftest.py
2125
if (!$?) { exit $LASTEXITCODE }
22-
& python -m pytest -vx Tests\check_wheel.py
26+
& $venv\Scripts\$python -m pytest -vx Tests\check_wheel.py
2327
if (!$?) { exit $LASTEXITCODE }
24-
& python -m pytest -vx Tests
28+
& $venv\Scripts\$python -m pytest -vx Tests
2529
if (!$?) { exit $LASTEXITCODE }

.github/workflows/wheels.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
- name: "macOS 10.13 x86_64"
5959
os: macos-13
6060
cibw_arch: x86_64
61-
build: "cp3{12,13}*"
61+
build: "cp3{12,13,14}*"
6262
macosx_deployment_target: "10.13"
6363
- name: "macOS 10.15 x86_64"
6464
os: macos-13
@@ -110,7 +110,6 @@ jobs:
110110
CIBW_MANYLINUX_PYPY_AARCH64_IMAGE: ${{ matrix.manylinux }}
111111
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: ${{ matrix.manylinux }}
112112
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux }}
113-
CIBW_SKIP: pp39-*
114113
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macosx_deployment_target }}
115114

116115
- uses: actions/upload-artifact@v4
@@ -160,7 +159,7 @@ jobs:
160159
# Install extra test images
161160
xcopy /S /Y Tests\test-images\* Tests\images
162161
163-
& python.exe winbuild\build_prepare.py -v --no-imagequant --no-avif --architecture=${{ matrix.cibw_arch }}
162+
& python.exe winbuild\build_prepare.py -v --no-imagequant --architecture=${{ matrix.cibw_arch }}
164163
shell: pwsh
165164

166165
- name: Build wheels
@@ -188,7 +187,6 @@ jobs:
188187
CIBW_BEFORE_ALL: "{package}\\winbuild\\build\\build_dep_all.cmd"
189188
CIBW_CACHE_PATH: "C:\\cibw"
190189
CIBW_ENABLE: cpython-prerelease cpython-freethreading pypy
191-
CIBW_SKIP: pp39-*
192190
CIBW_TEST_SKIP: "*-win_arm64"
193191
CIBW_TEST_COMMAND: 'docker run --rm
194192
-v {project}:C:\pillow

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
33
rev: v0.11.12
44
hooks:
5-
- id: ruff
5+
- id: ruff-check
66
args: [--exit-non-zero-on-fix]
77

88
- repo: https://github.com/psf/black-pre-commit-mirror

Tests/check_wheel.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,20 @@
99

1010

1111
def test_wheel_modules() -> None:
12-
expected_modules = {"pil", "tkinter", "freetype2", "littlecms2", "webp"}
12+
expected_modules = {"pil", "tkinter", "freetype2", "littlecms2", "webp", "avif"}
1313

14-
# tkinter is not available in cibuildwheel installed CPython on Windows
15-
try:
16-
import tkinter
14+
if sys.platform == "win32":
15+
# tkinter is not available in cibuildwheel installed CPython on Windows
16+
try:
17+
import tkinter
18+
19+
assert tkinter
20+
except ImportError:
21+
expected_modules.remove("tkinter")
1722

18-
assert tkinter
19-
except ImportError:
20-
expected_modules.remove("tkinter")
23+
# libavif is not available on Windows for ARM64 architectures
24+
if platform.machine() == "ARM64":
25+
expected_modules.remove("avif")
2126

2227
assert set(features.get_supported_modules()) == expected_modules
2328

0 commit comments

Comments
 (0)