Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/wheels-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,18 @@ function build_zlib_ng {
ORIGINAL_HOST_CONFIGURE_FLAGS=$HOST_CONFIGURE_FLAGS
unset HOST_CONFIGURE_FLAGS

build_github zlib-ng/zlib-ng $ZLIB_NG_VERSION --installnamedir=$BUILD_PREFIX/lib --zlib-compat
if [[ -n "$IS_MACOS" ]]; then
build_github zlib-ng/zlib-ng $ZLIB_NG_VERSION --installnamedir=$BUILD_PREFIX/lib --zlib-compat
else
# auditwheel does not bundle libz.so.1, so link zlib-ng statically,
# with hidden symbols so a system zlib cannot take its place.
CFLAGS="$CFLAGS -fPIC -fvisibility=hidden" build_github zlib-ng/zlib-ng $ZLIB_NG_VERSION --static --zlib-compat
# The shared install used to run ldconfig, which later steps rely on
# to find libraries in /usr/local/lib. musl has no cache.
if [[ -z "$IS_ALPINE" ]]; then
ldconfig
fi
fi

HOST_CONFIGURE_FLAGS=$ORIGINAL_HOST_CONFIGURE_FLAGS
touch zlib-stamp
Expand Down
11 changes: 11 additions & 0 deletions checks/check_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import platform
import sys

import pytest

from PIL import features


Expand Down Expand Up @@ -35,6 +37,15 @@ def test_wheel_codecs() -> None:
assert set(features.get_supported_codecs()) == expected_codecs


@pytest.mark.skipif(sys.platform != "linux", reason="Linux-only check")
def test_wheel_zlib_ng_linked_statically() -> None:
# The Linux wheels link zlib-ng statically, so the version at runtime
# should be from zlib-ng, whichever zlib the system has
version = features.version_codec("zlib")
assert version is not None
assert version.endswith(".zlib-ng")


def test_wheel_features() -> None:
expected_features = {
"raqm",
Expand Down
10 changes: 10 additions & 0 deletions docs/releasenotes/13.1.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,13 @@ WebP encoding errors now include a description

When libwebp fails to encode an image, the raised :py:exc:`ValueError` now
consistently describes the error rather than only reporting a numeric code.

zlib-ng in Linux wheels
^^^^^^^^^^^^^^^^^^^^^^^

The Linux wheels now link zlib-ng statically. Previously, zlib-ng was built but
not bundled into the wheels, so the system zlib was used at runtime instead, and
``PIL.features.version_feature("zlib_ng")`` reported a version that was not in use.
Pillow 13.0.0 also failed to import on systems where ``libz.so.1`` was not on the
default library search path, such as NixOS. Linux wheels no longer require a
system zlib, and gain the speed of zlib-ng as macOS and Windows wheels already did.
Loading