Merge branch 'main' into progress

This commit is contained in:
Andrew Murray 2025-03-18 22:35:09 +11:00 committed by GitHub
commit ac009d066b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 46 additions and 25 deletions

View File

@ -20,7 +20,7 @@ fi
set -e set -e
if [[ $(uname) != CYGWIN* ]]; then if [[ $(uname) != CYGWIN* ]]; then
sudo apt-get -qq install libfreetype6-dev liblcms2-dev python3-tk\ sudo apt-get -qq install libfreetype6-dev liblcms2-dev libtiff-dev python3-tk\
ghostscript libjpeg-turbo8-dev libopenjp2-7-dev\ ghostscript libjpeg-turbo8-dev libopenjp2-7-dev\
cmake meson imagemagick libharfbuzz-dev libfribidi-dev\ cmake meson imagemagick libharfbuzz-dev libfribidi-dev\
sway wl-clipboard libopenblas-dev sway wl-clipboard libopenblas-dev

View File

@ -1 +1 @@
cibuildwheel==2.23.0 cibuildwheel==2.23.1

View File

@ -16,6 +16,6 @@
} }
], ],
"schedule": [ "schedule": [
"on the 3rd day of the month" "* * 3 * *"
] ]
} }

View File

@ -35,6 +35,10 @@ jobs:
matrix: matrix:
os: ["ubuntu-latest"] os: ["ubuntu-latest"]
docker: [ docker: [
# Run slower jobs first to give them a headstart and reduce waiting time
ubuntu-24.04-noble-ppc64le,
ubuntu-24.04-noble-s390x,
# Then run the remainder
alpine, alpine,
amazon-2-amd64, amazon-2-amd64,
amazon-2023-amd64, amazon-2023-amd64,
@ -52,13 +56,9 @@ jobs:
dockerTag: [main] dockerTag: [main]
include: include:
- docker: "ubuntu-24.04-noble-ppc64le" - docker: "ubuntu-24.04-noble-ppc64le"
os: "ubuntu-22.04"
qemu-arch: "ppc64le" qemu-arch: "ppc64le"
dockerTag: main
- docker: "ubuntu-24.04-noble-s390x" - docker: "ubuntu-24.04-noble-s390x"
os: "ubuntu-22.04"
qemu-arch: "s390x" qemu-arch: "s390x"
dockerTag: main
- docker: "ubuntu-24.04-noble-arm64v8" - docker: "ubuntu-24.04-noble-arm64v8"
os: "ubuntu-24.04-arm" os: "ubuntu-24.04-arm"
dockerTag: main dockerTag: main
@ -75,8 +75,9 @@ jobs:
- name: Set up QEMU - name: Set up QEMU
if: "matrix.qemu-arch" if: "matrix.qemu-arch"
run: | uses: docker/setup-qemu-action@v3
docker run --rm --privileged aptman/qus -s -- -p ${{ matrix.qemu-arch }} with:
platforms: ${{ matrix.qemu-arch }}
- name: Docker pull - name: Docker pull
run: | run: |

View File

@ -94,8 +94,8 @@ jobs:
choco install nasm --no-progress choco install nasm --no-progress
echo "C:\Program Files\NASM" >> $env:GITHUB_PATH echo "C:\Program Files\NASM" >> $env:GITHUB_PATH
choco install ghostscript --version=10.4.0 --no-progress choco install ghostscript --version=10.5.0 --no-progress
echo "C:\Program Files\gs\gs10.04.0\bin" >> $env:GITHUB_PATH echo "C:\Program Files\gs\gs10.05.0\bin" >> $env:GITHUB_PATH
# Install extra test images # Install extra test images
xcopy /S /Y Tests\test-images\* Tests\images xcopy /S /Y Tests\test-images\* Tests\images

View File

@ -43,7 +43,7 @@ LIBPNG_VERSION=1.6.47
JPEGTURBO_VERSION=3.1.0 JPEGTURBO_VERSION=3.1.0
OPENJPEG_VERSION=2.5.3 OPENJPEG_VERSION=2.5.3
XZ_VERSION=5.6.4 XZ_VERSION=5.6.4
TIFF_VERSION=4.6.0 TIFF_VERSION=4.7.0
LCMS2_VERSION=2.17 LCMS2_VERSION=2.17
ZLIB_NG_VERSION=2.2.4 ZLIB_NG_VERSION=2.2.4
LIBWEBP_VERSION=1.5.0 LIBWEBP_VERSION=1.5.0

View File

@ -35,8 +35,11 @@ def test_apng_basic() -> None:
with pytest.raises(EOFError): with pytest.raises(EOFError):
im.seek(2) im.seek(2)
# test rewind support
im.seek(0) im.seek(0)
with pytest.raises(ValueError, match="cannot seek to frame 2"):
im._seek(2)
# test rewind support
assert im.getpixel((0, 0)) == (255, 0, 0, 255) assert im.getpixel((0, 0)) == (255, 0, 0, 255)
assert im.getpixel((64, 32)) == (255, 0, 0, 255) assert im.getpixel((64, 32)) == (255, 0, 0, 255)
im.seek(1) im.seek(1)

View File

@ -1,5 +1,6 @@
from __future__ import annotations from __future__ import annotations
import io
import warnings import warnings
import pytest import pytest
@ -132,6 +133,15 @@ def test_eoferror() -> None:
im.seek(n_frames - 1) im.seek(n_frames - 1)
def test_missing_frame_size() -> None:
with open(animated_test_file, "rb") as fp:
data = fp.read()
data = data[:6188]
with Image.open(io.BytesIO(data)) as im:
with pytest.raises(EOFError, match="missing frame size"):
im.seek(1)
def test_seek_tell() -> None: def test_seek_tell() -> None:
with Image.open(animated_test_file) as im: with Image.open(animated_test_file) as im:
layer_number = im.tell() layer_number = im.tell()
@ -160,6 +170,9 @@ def test_seek() -> None:
assert_image_equal_tofile(im, "Tests/images/a_fli.png") assert_image_equal_tofile(im, "Tests/images/a_fli.png")
with pytest.raises(ValueError, match="cannot seek to frame 52"):
im._seek(52)
@pytest.mark.parametrize( @pytest.mark.parametrize(
"test_file", "test_file",

View File

@ -458,6 +458,10 @@ def test_seek() -> None:
except EOFError: except EOFError:
assert frame_count == 5 assert frame_count == 5
img.seek(0)
with pytest.raises(ValueError, match="cannot seek to frame 2"):
img._seek(2)
def test_seek_info() -> None: def test_seek_info() -> None:
with Image.open("Tests/images/iss634.gif") as im: with Image.open("Tests/images/iss634.gif") as im:

View File

@ -317,12 +317,12 @@ def test_grayscale_four_channels() -> None:
with open("Tests/images/rgb_trns_ycbc.jp2", "rb") as fp: with open("Tests/images/rgb_trns_ycbc.jp2", "rb") as fp:
data = fp.read() data = fp.read()
# Change color space to OPJ_CLRSPC_GRAY # Change color space to OPJ_CLRSPC_GRAY
data = data[:76] + b"\x11" + data[77:] data = data[:76] + b"\x11" + data[77:]
with Image.open(BytesIO(data)) as im: with Image.open(BytesIO(data)) as im:
im.load() im.load()
assert im.mode == "RGBA" assert im.mode == "RGBA"
@pytest.mark.skipif( @pytest.mark.skipif(

View File

@ -40,7 +40,7 @@ def test_sanity(tmp_path: Path) -> None:
def test_bad_image_size() -> None: def test_bad_image_size() -> None:
with open("Tests/images/pil184.pcx", "rb") as fp: with open("Tests/images/pil184.pcx", "rb") as fp:
data = fp.read() data = fp.read()
data = data[:4] + b"\xff\xff" + data[6:] data = data[:4] + b"\xff\xff" + data[6:]
b = io.BytesIO(data) b = io.BytesIO(data)
with pytest.raises(SyntaxError, match="bad PCX image size"): with pytest.raises(SyntaxError, match="bad PCX image size"):
@ -51,7 +51,7 @@ def test_bad_image_size() -> None:
def test_unknown_mode() -> None: def test_unknown_mode() -> None:
with open("Tests/images/pil184.pcx", "rb") as fp: with open("Tests/images/pil184.pcx", "rb") as fp:
data = fp.read() data = fp.read()
data = data[:3] + b"\xff" + data[4:] data = data[:3] + b"\xff" + data[4:]
b = io.BytesIO(data) b = io.BytesIO(data)
with pytest.raises(OSError, match="unknown PCX mode"): with pytest.raises(OSError, match="unknown PCX mode"):

View File

@ -20,8 +20,8 @@ def test_sanity() -> None:
def test_zero_width_chars() -> None: def test_zero_width_chars() -> None:
with open(filename, "rb") as fp: with open(filename, "rb") as fp:
data = fp.read() data = fp.read()
data = data[:2650] + b"\x00\x00" + data[2652:] data = data[:2650] + b"\x00\x00" + data[2652:]
BdfFontFile.BdfFontFile(io.BytesIO(data)) BdfFontFile.BdfFontFile(io.BytesIO(data))
def test_invalid_file() -> None: def test_invalid_file() -> None:

View File

@ -68,7 +68,7 @@ by DirectX.
DXT1 and DXT5 pixel formats can be read, only in ``RGBA`` mode. DXT1 and DXT5 pixel formats can be read, only in ``RGBA`` mode.
.. versionadded:: 3.4.0 .. versionadded:: 3.4.0
DXT3 images can be read in ``RGB`` mode and DX10 images can be read in DXT3 images can be read in ``RGBA`` mode and DX10 images can be read in
``RGB`` and ``RGBA`` mode. ``RGB`` and ``RGBA`` mode.
.. versionadded:: 6.0.0 .. versionadded:: 6.0.0

View File

@ -44,7 +44,7 @@ Many of Pillow's features require external libraries:
* **libtiff** provides compressed TIFF functionality * **libtiff** provides compressed TIFF functionality
* Pillow has been tested with libtiff versions **3.x** and **4.0-4.6.0** * Pillow has been tested with libtiff versions **3.x** and **4.0-4.7.0**
* **libfreetype** provides type related services * **libfreetype** provides type related services

View File

@ -120,7 +120,7 @@ V = {
"LIBPNG": "1.6.47", "LIBPNG": "1.6.47",
"LIBWEBP": "1.5.0", "LIBWEBP": "1.5.0",
"OPENJPEG": "2.5.3", "OPENJPEG": "2.5.3",
"TIFF": "4.6.0", "TIFF": "4.7.0",
"XZ": "5.6.4", "XZ": "5.6.4",
"ZLIBNG": "2.2.4", "ZLIBNG": "2.2.4",
} }