Skip to content

Commit cad6b3d

Browse files
authored
Merge branch 'main' into mode_enums
2 parents e76fcd5 + 769a14d commit cad6b3d

File tree

127 files changed

+1506
-1398
lines changed

Some content is hidden

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

127 files changed

+1506
-1398
lines changed

.ci/install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
aptget_update()
44
{
5-
if [ ! -z $1 ]; then
5+
if [ -n "$1" ]; then
66
echo ""
77
echo "Retrying apt-get update..."
88
echo ""
99
fi
10-
output=`sudo apt-get update 2>&1`
10+
output=$(sudo apt-get update 2>&1)
1111
echo "$output"
1212
if [[ $output == *[WE]:\ * ]]; then
1313
return 1

.github/workflows/macos-install.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ brew install \
1010
ghostscript \
1111
jpeg-turbo \
1212
libimagequant \
13+
libraqm \
1314
libtiff \
1415
little-cms2 \
1516
openjpeg \
1617
webp
17-
if [[ "$ImageOS" == "macos13" ]]; then
18-
brew install --ignore-dependencies libraqm
19-
else
20-
brew install libraqm
21-
fi
2218
export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig"
2319

2420
python3 -m pip install coverage

.github/workflows/test-docker.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ jobs:
3535
matrix:
3636
os: ["ubuntu-latest"]
3737
docker: [
38-
# Run slower jobs first to give them a headstart and reduce waiting time
39-
ubuntu-24.04-noble-ppc64le,
40-
ubuntu-24.04-noble-s390x,
41-
# Then run the remainder
4238
alpine,
4339
amazon-2-amd64,
4440
amazon-2023-amd64,
@@ -56,9 +52,13 @@ jobs:
5652
dockerTag: [main]
5753
include:
5854
- docker: "ubuntu-24.04-noble-ppc64le"
55+
os: "ubuntu-22.04"
5956
qemu-arch: "ppc64le"
57+
dockerTag: main
6058
- docker: "ubuntu-24.04-noble-s390x"
59+
os: "ubuntu-22.04"
6160
qemu-arch: "s390x"
61+
dockerTag: main
6262
- docker: "ubuntu-24.04-noble-arm64v8"
6363
os: "ubuntu-24.04-arm"
6464
dockerTag: main

.github/workflows/test-mingw.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ jobs:
6060
mingw-w64-x86_64-gcc \
6161
mingw-w64-x86_64-ghostscript \
6262
mingw-w64-x86_64-lcms2 \
63-
mingw-w64-x86_64-libimagequant \
6463
mingw-w64-x86_64-libjpeg-turbo \
6564
mingw-w64-x86_64-libraqm \
6665
mingw-w64-x86_64-libtiff \

.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.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", "3.14"]
3939
architecture: ["x64"]
4040
os: ["windows-latest"]
4141
include:

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
"ubuntu-latest",
4242
]
4343
python-version: [
44+
"pypy3.11",
4445
"pypy3.10",
4546
"3.14",
4647
"3.13t",

.github/workflows/wheels-dependencies.sh

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ ARCHIVE_SDIR=pillow-depends-main
3838

3939
# Package versions for fresh source builds
4040
FREETYPE_VERSION=2.13.3
41-
HARFBUZZ_VERSION=10.1.0
42-
LIBPNG_VERSION=1.6.45
41+
HARFBUZZ_VERSION=10.2.0
42+
LIBPNG_VERSION=1.6.46
4343
JPEGTURBO_VERSION=3.1.0
4444
OPENJPEG_VERSION=2.5.3
45-
XZ_VERSION=5.6.3
45+
XZ_VERSION=5.6.4
4646
TIFF_VERSION=4.6.0
4747
LCMS2_VERSION=2.16
48-
ZLIB_NG_VERSION=2.2.3
48+
ZLIB_NG_VERSION=2.2.4
4949
LIBWEBP_VERSION=1.5.0
5050
BZIP2_VERSION=1.0.8
5151
LIBXCB_VERSION=1.17.0
@@ -54,13 +54,10 @@ BROTLI_VERSION=1.1.0
5454
function build_pkg_config {
5555
if [ -e pkg-config-stamp ]; then return; fi
5656
# This essentially duplicates the Homebrew recipe
57-
ORIGINAL_CFLAGS=$CFLAGS
58-
CFLAGS="$CFLAGS -Wno-int-conversion"
59-
build_simple pkg-config 0.29.2 https://pkg-config.freedesktop.org/releases tar.gz \
57+
CFLAGS="$CFLAGS -Wno-int-conversion" build_simple pkg-config 0.29.2 https://pkg-config.freedesktop.org/releases tar.gz \
6058
--disable-debug --disable-host-tool --with-internal-glib \
6159
--with-pc-path=$BUILD_PREFIX/share/pkgconfig:$BUILD_PREFIX/lib/pkgconfig \
6260
--with-system-include-path=$(xcrun --show-sdk-path --sdk macosx)/usr/include
63-
CFLAGS=$ORIGINAL_CFLAGS
6461
export PKG_CONFIG=$BUILD_PREFIX/bin/pkg-config
6562
touch pkg-config-stamp
6663
}
@@ -72,6 +69,14 @@ function build_zlib_ng {
7269
&& ./configure --prefix=$BUILD_PREFIX --zlib-compat \
7370
&& make -j4 \
7471
&& make install)
72+
73+
if [ -n "$IS_MACOS" ]; then
74+
# Ensure that on macOS, the library name is an absolute path, not an
75+
# @rpath, so that delocate picks up the right library (and doesn't need
76+
# DYLD_LIBRARY_PATH to be set). The default Makefile doesn't have an
77+
# option to control the install_name.
78+
install_name_tool -id $BUILD_PREFIX/lib/libz.1.dylib $BUILD_PREFIX/lib/libz.1.dylib
79+
fi
7580
touch zlib-stamp
7681
}
7782

@@ -130,15 +135,13 @@ function build {
130135
build_lcms2
131136
build_openjpeg
132137

133-
ORIGINAL_CFLAGS=$CFLAGS
134-
CFLAGS="$CFLAGS -O3 -DNDEBUG"
138+
webp_cflags="-O3 -DNDEBUG"
135139
if [[ -n "$IS_MACOS" ]]; then
136-
CFLAGS="$CFLAGS -Wl,-headerpad_max_install_names"
140+
webp_cflags="$webp_cflags -Wl,-headerpad_max_install_names"
137141
fi
138-
build_simple libwebp $LIBWEBP_VERSION \
142+
CFLAGS="$CFLAGS $webp_cflags" build_simple libwebp $LIBWEBP_VERSION \
139143
https://storage.googleapis.com/downloads.webmproject.org/releases/webp tar.gz \
140144
--enable-libwebpmux --enable-libwebpdemux
141-
CFLAGS=$ORIGINAL_CFLAGS
142145

143146
build_brotli
144147

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.8.6
3+
rev: v0.9.4
44
hooks:
55
- id: ruff
66
args: [--exit-non-zero-on-fix]
77

88
- repo: https://github.com/psf/black-pre-commit-mirror
9-
rev: 24.10.0
9+
rev: 25.1.0
1010
hooks:
1111
- id: black
1212

1313
- repo: https://github.com/PyCQA/bandit
14-
rev: 1.8.0
14+
rev: 1.8.2
1515
hooks:
1616
- id: bandit
1717
args: [--severity-level=high]
@@ -24,7 +24,7 @@ repos:
2424
exclude: (Makefile$|\.bat$|\.cmake$|\.eps$|\.fits$|\.gd$|\.opt$)
2525

2626
- repo: https://github.com/pre-commit/mirrors-clang-format
27-
rev: v19.1.6
27+
rev: v19.1.7
2828
hooks:
2929
- id: clang-format
3030
types: [c]
@@ -50,14 +50,14 @@ repos:
5050
exclude: ^.github/.*TEMPLATE|^Tests/(fonts|images)/
5151

5252
- repo: https://github.com/python-jsonschema/check-jsonschema
53-
rev: 0.30.0
53+
rev: 0.31.1
5454
hooks:
5555
- id: check-github-workflows
5656
- id: check-readthedocs
5757
- id: check-renovate
5858

5959
- repo: https://github.com/woodruffw/zizmor-pre-commit
60-
rev: v1.0.0
60+
rev: v1.3.0
6161
hooks:
6262
- id: zizmor
6363

@@ -78,7 +78,7 @@ repos:
7878
additional_dependencies: [trove-classifiers>=2024.10.12]
7979

8080
- repo: https://github.com/tox-dev/tox-ini-fmt
81-
rev: 1.4.1
81+
rev: 1.5.0
8282
hooks:
8383
- id: tox-ini-fmt
8484

Tests/check_png_dos.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,25 @@
33
import zlib
44
from io import BytesIO
55

6+
import pytest
7+
68
from PIL import Image, ImageFile, PngImagePlugin
79

810
TEST_FILE = "Tests/images/png_decompression_dos.png"
911

1012

11-
def test_ignore_dos_text() -> None:
12-
ImageFile.LOAD_TRUNCATED_IMAGES = True
13+
def test_ignore_dos_text(monkeypatch: pytest.MonkeyPatch) -> None:
14+
monkeypatch.setattr(ImageFile, "LOAD_TRUNCATED_IMAGES", True)
1315

14-
try:
15-
im = Image.open(TEST_FILE)
16+
with Image.open(TEST_FILE) as im:
1617
im.load()
17-
finally:
18-
ImageFile.LOAD_TRUNCATED_IMAGES = False
1918

20-
assert isinstance(im, PngImagePlugin.PngImageFile)
21-
for s in im.text.values():
22-
assert len(s) < 1024 * 1024, "Text chunk larger than 1M"
19+
assert isinstance(im, PngImagePlugin.PngImageFile)
20+
for s in im.text.values():
21+
assert len(s) < 1024 * 1024, "Text chunk larger than 1M"
2322

24-
for s in im.info.values():
25-
assert len(s) < 1024 * 1024, "Text chunk larger than 1M"
23+
for s in im.info.values():
24+
assert len(s) < 1024 * 1024, "Text chunk larger than 1M"
2625

2726

2827
def test_dos_text() -> None:

Tests/helper.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import shutil
1010
import subprocess
1111
import sys
12-
import sysconfig
1312
import tempfile
1413
from collections.abc import Sequence
1514
from functools import lru_cache
@@ -342,10 +341,6 @@ def is_pypy() -> bool:
342341
return hasattr(sys, "pypy_translation_info")
343342

344343

345-
def is_mingw() -> bool:
346-
return sysconfig.get_platform() == "mingw"
347-
348-
349344
class CachedProperty:
350345
def __init__(self, func: Callable[[Any], Any]) -> None:
351346
self.func = func

0 commit comments

Comments
 (0)