Skip to content

Commit 2b62c0b

Browse files
authored
Merge branch 'main' into image_grab_wayland_kde
2 parents feaded9 + 869aa58 commit 2b62c0b

File tree

104 files changed

+4278
-50
lines changed

Some content is hidden

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

104 files changed

+4278
-50
lines changed

.ci/install.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if [[ $(uname) != CYGWIN* ]]; then
2323
sudo apt-get -qq install libfreetype6-dev liblcms2-dev libtiff-dev python3-tk\
2424
ghostscript libjpeg-turbo8-dev libopenjp2-7-dev\
2525
cmake meson imagemagick libharfbuzz-dev libfribidi-dev\
26-
sway wl-clipboard libopenblas-dev
26+
sway wl-clipboard libopenblas-dev nasm
2727
fi
2828

2929
python3 -m pip install --upgrade pip
@@ -36,6 +36,9 @@ python3 -m pip install -U pytest
3636
python3 -m pip install -U pytest-cov
3737
python3 -m pip install -U pytest-timeout
3838
python3 -m pip install pyroma
39+
# optional test dependency, only install if there's a binary package.
40+
# fails on beta 3.14 and PyPy
41+
python3 -m pip install --only-binary=:all: pyarrow || true
3942

4043
if [[ $(uname) != CYGWIN* ]]; then
4144
python3 -m pip install numpy
@@ -62,6 +65,9 @@ if [[ $(uname) != CYGWIN* ]]; then
6265
# raqm
6366
pushd depends && ./install_raqm.sh && popd
6467

68+
# libavif
69+
pushd depends && CMAKE_POLICY_VERSION_MINIMUM=3.5 ./install_libavif.sh && popd
70+
6571
# extra test images
6672
pushd depends && ./install_extra_test_images.sh && popd
6773
else

.github/workflows/macos-install.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ if [[ "$ImageOS" == "macos13" ]]; then
66
brew uninstall gradle maven
77
fi
88
brew install \
9+
aom \
10+
dav1d \
911
freetype \
1012
ghostscript \
1113
jpeg-turbo \
@@ -14,6 +16,8 @@ brew install \
1416
libtiff \
1517
little-cms2 \
1618
openjpeg \
19+
rav1e \
20+
svt-av1 \
1721
webp
1822
export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig"
1923

@@ -26,6 +30,12 @@ python3 -m pip install -U pytest-cov
2630
python3 -m pip install -U pytest-timeout
2731
python3 -m pip install pyroma
2832
python3 -m pip install numpy
33+
# optional test dependency, only install if there's a binary package.
34+
# fails on beta 3.14 and PyPy
35+
python3 -m pip install --only-binary=:all: pyarrow || true
36+
37+
# libavif
38+
pushd depends && ./install_libavif.sh && popd
2939

3040
# extra test images
3141
pushd depends && ./install_extra_test_images.sh && popd

.github/workflows/test-mingw.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ jobs:
6060
mingw-w64-x86_64-gcc \
6161
mingw-w64-x86_64-ghostscript \
6262
mingw-w64-x86_64-lcms2 \
63+
mingw-w64-x86_64-libavif \
6364
mingw-w64-x86_64-libimagequant \
6465
mingw-w64-x86_64-libjpeg-turbo \
6566
mingw-w64-x86_64-libraqm \

.github/workflows/test-windows.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
# Test the oldest Python on 32-bit
4343
- { python-version: "3.9", architecture: "x86", os: "windows-2019" }
4444

45-
timeout-minutes: 30
45+
timeout-minutes: 45
4646

4747
name: Python ${{ matrix.python-version }} (${{ matrix.architecture }})
4848

@@ -88,6 +88,10 @@ jobs:
8888
run: |
8989
python3 -m pip install PyQt6
9090
91+
- name: Install PyArrow dependency
92+
run: |
93+
python3 -m pip install --only-binary=:all: pyarrow || true
94+
9195
- name: Install dependencies
9296
id: install
9397
run: |
@@ -145,6 +149,10 @@ jobs:
145149
if: steps.build-cache.outputs.cache-hit != 'true'
146150
run: "& winbuild\\build\\build_dep_libpng.cmd"
147151

152+
- name: Build dependencies / libavif
153+
if: steps.build-cache.outputs.cache-hit != 'true' && matrix.architecture == 'x64'
154+
run: "& winbuild\\build\\build_dep_libavif.cmd"
155+
148156
# for FreeType WOFF2 font support
149157
- name: Build dependencies / brotli
150158
if: steps.build-cache.outputs.cache-hit != 'true'

.github/workflows/wheels-dependencies.sh

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ else
2525
MB_ML_LIBC=${AUDITWHEEL_POLICY::9}
2626
MB_ML_VER=${AUDITWHEEL_POLICY:9}
2727
fi
28-
PLAT=$CIBW_ARCHS
28+
PLAT="${CIBW_ARCHS:-$AUDITWHEEL_ARCH}"
2929

3030
# Define custom utilities
3131
source wheels/multibuild/common_utils.sh
@@ -42,18 +42,30 @@ HARFBUZZ_VERSION=11.0.0
4242
LIBPNG_VERSION=1.6.47
4343
JPEGTURBO_VERSION=3.1.0
4444
OPENJPEG_VERSION=2.5.3
45-
if [[ $MB_ML_VER == 2014 ]]; then
46-
XZ_VERSION=5.6.4
47-
else
48-
XZ_VERSION=5.8.0
49-
fi
45+
XZ_VERSION=5.8.0
5046
TIFF_VERSION=4.7.0
5147
LCMS2_VERSION=2.17
48+
ZLIB_VERSION=1.3.1
5249
ZLIB_NG_VERSION=2.2.4
5350
LIBWEBP_VERSION=1.5.0
5451
BZIP2_VERSION=1.0.8
5552
LIBXCB_VERSION=1.17.0
5653
BROTLI_VERSION=1.1.0
54+
LIBAVIF_VERSION=1.2.1
55+
56+
if [[ $MB_ML_VER == 2014 ]]; then
57+
function build_xz {
58+
if [ -e xz-stamp ]; then return; fi
59+
yum install -y gettext-devel
60+
fetch_unpack https://tukaani.org/xz/xz-$XZ_VERSION.tar.gz
61+
(cd xz-$XZ_VERSION \
62+
&& ./autogen.sh --no-po4a \
63+
&& ./configure --prefix=$BUILD_PREFIX \
64+
&& make -j4 \
65+
&& make install)
66+
touch xz-stamp
67+
}
68+
fi
5769

5870
function build_pkg_config {
5971
if [ -e pkg-config-stamp ]; then return; fi
@@ -105,12 +117,55 @@ function build_harfbuzz {
105117
touch harfbuzz-stamp
106118
}
107119

120+
function build_libavif {
121+
if [ -e libavif-stamp ]; then return; fi
122+
123+
python3 -m pip install meson ninja
124+
125+
if [[ "$PLAT" == "x86_64" ]] || [ -n "$SANITIZER" ]; then
126+
build_simple nasm 2.16.03 https://www.nasm.us/pub/nasm/releasebuilds/2.16.03
127+
fi
128+
129+
# For rav1e
130+
curl https://sh.rustup.rs -sSf | sh -s -- -y
131+
. "$HOME/.cargo/env"
132+
if [ -z "$IS_ALPINE" ] && [ -z "$SANITIZER" ] && [ -z "$IS_MACOS" ]; then
133+
yum install -y perl
134+
if [[ "$MB_ML_VER" == 2014 ]]; then
135+
yum install -y perl-IPC-Cmd
136+
fi
137+
fi
138+
139+
local out_dir=$(fetch_unpack https://github.com/AOMediaCodec/libavif/archive/refs/tags/v$LIBAVIF_VERSION.tar.gz libavif-$LIBAVIF_VERSION.tar.gz)
140+
(cd $out_dir \
141+
&& CMAKE_POLICY_VERSION_MINIMUM=3.5 cmake \
142+
-DCMAKE_INSTALL_PREFIX=$BUILD_PREFIX \
143+
-DCMAKE_INSTALL_LIBDIR=$BUILD_PREFIX/lib \
144+
-DCMAKE_BUILD_TYPE=Release \
145+
-DBUILD_SHARED_LIBS=OFF \
146+
-DAVIF_LIBSHARPYUV=LOCAL \
147+
-DAVIF_LIBYUV=LOCAL \
148+
-DAVIF_CODEC_AOM=LOCAL \
149+
-DAVIF_CODEC_DAV1D=LOCAL \
150+
-DAVIF_CODEC_RAV1E=LOCAL \
151+
-DAVIF_CODEC_SVT=LOCAL \
152+
-DENABLE_NASM=ON \
153+
-DCMAKE_MODULE_PATH=/tmp/cmake/Modules \
154+
. \
155+
&& make install)
156+
touch libavif-stamp
157+
}
158+
108159
function build {
109160
build_xz
110161
if [ -z "$IS_ALPINE" ] && [ -z "$SANITIZER" ] && [ -z "$IS_MACOS" ]; then
111162
yum remove -y zlib-devel
112163
fi
113-
build_zlib_ng
164+
if [[ -n "$IS_MACOS" ]] && [[ "$MACOSX_DEPLOYMENT_TARGET" == "10.10" || "$MACOSX_DEPLOYMENT_TARGET" == "10.13" ]]; then
165+
build_new_zlib
166+
else
167+
build_zlib_ng
168+
fi
114169

115170
build_simple xcb-proto 1.17.0 https://xorg.freedesktop.org/archive/individual/proto
116171
if [ -n "$IS_MACOS" ]; then
@@ -135,6 +190,7 @@ function build {
135190
build_tiff
136191
fi
137192

193+
build_libavif
138194
build_libpng
139195
build_lcms2
140196
build_openjpeg

.github/workflows/wheels.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ jobs:
160160
& python.exe winbuild\build_prepare.py -v --no-imagequant --architecture=${{ matrix.cibw_arch }}
161161
shell: pwsh
162162

163+
- name: Update rust
164+
if: matrix.cibw_arch == 'AMD64'
165+
run: |
166+
rustup update
167+
163168
- name: Build wheels
164169
run: |
165170
setlocal EnableDelayedExpansion

Tests/check_wheel.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
from __future__ import annotations
22

3+
import platform
4+
import struct
35
import sys
46

57
from PIL import features
68

9+
from .helper import is_pypy
10+
711

812
def test_wheel_modules() -> None:
9-
expected_modules = {"pil", "tkinter", "freetype2", "littlecms2", "webp"}
13+
expected_modules = {"pil", "tkinter", "freetype2", "littlecms2", "webp", "avif"}
1014

1115
# tkinter is not available in cibuildwheel installed CPython on Windows
1216
try:
@@ -16,6 +20,11 @@ def test_wheel_modules() -> None:
1620
except ImportError:
1721
expected_modules.remove("tkinter")
1822

23+
# libavif is not available on Windows for x86 and ARM64 architectures
24+
if sys.platform == "win32":
25+
if platform.machine() == "ARM64" or struct.calcsize("P") == 4:
26+
expected_modules.remove("avif")
27+
1928
assert set(features.get_supported_modules()) == expected_modules
2029

2130

@@ -40,5 +49,7 @@ def test_wheel_features() -> None:
4049

4150
if sys.platform == "win32":
4251
expected_features.remove("xcb")
52+
elif sys.platform == "darwin" and not is_pypy() and platform.processor() != "arm":
53+
expected_features.remove("zlib_ng")
4354

4455
assert set(features.get_supported_features()) == expected_features

Tests/images/avif/exif.avif

15.7 KB
Binary file not shown.
5.31 KB
Binary file not shown.

Tests/images/avif/hopper.avif

3 KB
Binary file not shown.

0 commit comments

Comments
 (0)