diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml index 033ff98ce74..eb73fc6a7cd 100644 --- a/.github/workflows/cifuzz.yml +++ b/.github/workflows/cifuzz.yml @@ -24,8 +24,6 @@ concurrency: jobs: Fuzzing: - # Disabled until google/oss-fuzz#11419 upgrades Python to 3.9+ - if: false runs-on: ubuntu-latest steps: - name: Build Fuzzers diff --git a/.github/workflows/wheels-dependencies.sh b/.github/workflows/wheels-dependencies.sh index bb0f8a307e3..b3996d5a110 100755 --- a/.github/workflows/wheels-dependencies.sh +++ b/.github/workflows/wheels-dependencies.sh @@ -16,11 +16,7 @@ ARCHIVE_SDIR=pillow-depends-main # Package versions for fresh source builds FREETYPE_VERSION=2.13.2 -if [[ -n "$IS_MACOS" ]] || ([[ "$MB_ML_VER" != 2014 ]] && [[ -z "$SANITIZER" ]]); then - HARFBUZZ_VERSION=10.0.1 -else - HARFBUZZ_VERSION=8.5.0 -fi +HARFBUZZ_VERSION=10.0.1 LIBPNG_VERSION=1.6.44 JPEGTURBO_VERSION=3.0.4 OPENJPEG_VERSION=2.5.2 @@ -65,21 +61,15 @@ function build_brotli { } function build_harfbuzz { - if [[ "$HARFBUZZ_VERSION" == 8.5.0 ]]; then - export FREETYPE_LIBS=-lfreetype - export FREETYPE_CFLAGS=-I/usr/local/include/freetype2/ - build_simple harfbuzz $HARFBUZZ_VERSION https://github.com/harfbuzz/harfbuzz/releases/download/$HARFBUZZ_VERSION tar.xz --with-freetype=yes --with-glib=no - export FREETYPE_LIBS="" - export FREETYPE_CFLAGS="" - else - local out_dir=$(fetch_unpack https://github.com/harfbuzz/harfbuzz/releases/download/$HARFBUZZ_VERSION/$HARFBUZZ_VERSION.tar.xz harfbuzz-$HARFBUZZ_VERSION.tar.xz) - (cd $out_dir \ - && meson setup build --buildtype=release -Dfreetype=enabled -Dglib=disabled) - (cd $out_dir/build \ - && meson install) - if [[ "$MB_ML_LIBC" == "manylinux" ]]; then - cp /usr/local/lib64/libharfbuzz* /usr/local/lib - fi + python3 -m pip install meson ninja + + local out_dir=$(fetch_unpack https://github.com/harfbuzz/harfbuzz/releases/download/$HARFBUZZ_VERSION/$HARFBUZZ_VERSION.tar.xz harfbuzz-$HARFBUZZ_VERSION.tar.xz) + (cd $out_dir \ + && meson setup build --buildtype=release -Dfreetype=enabled -Dglib=disabled) + (cd $out_dir/build \ + && meson install) + if [[ "$MB_ML_LIBC" == "manylinux" ]]; then + cp /usr/local/lib64/libharfbuzz* /usr/local/lib fi } @@ -155,11 +145,7 @@ if [[ -n "$IS_MACOS" ]]; then brew remove --ignore-dependencies webp fi - brew install meson pkg-config -elif [[ -n "$IS_ALPINE" ]]; then - apk add meson -elif [[ "$HARFBUZZ_VERSION" != 8.5.0 ]]; then - yum install -y meson + brew install pkg-config fi wrap_wheel_builder build diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index d3c2ac44c80..ee0c331660a 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -278,7 +278,7 @@ jobs: path: dist merge-multiple: true - name: Upload wheels to scientific-python-nightly-wheels - uses: scientific-python/upload-nightly-action@b67d7fcc0396e1128a474d1ab2b48aa94680f9fc # 0.5.0 + uses: scientific-python/upload-nightly-action@ccf29c805b5d0c1dc31fa97fcdb962be074cade3 # 0.6.0 with: artifacts_path: dist anaconda_nightly_upload_token: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }} diff --git a/CHANGES.rst b/CHANGES.rst index 6ff35ea4f98..b4644c541ef 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,15 +5,15 @@ Changelog (Pillow) 11.0.0 (unreleased) ------------------- +- Improved copying imagequant libraries #8420 + [radarhere] + - Use Capsule for WebP saving #8386 [homm, radarhere] - Fixed writing multiple StripOffsets to TIFF #8317 [Yay295, radarhere] -- Shared imagequant libraries may be located within usr/lib64 #8407 - [radarhere] - - Fix dereference before checking for NULL in ImagingTransformAffine #8398 [PavlNekrasov] diff --git a/Makefile b/Makefile index 94f7565d826..ec415962740 100644 --- a/Makefile +++ b/Makefile @@ -117,7 +117,7 @@ lint-fix: python3 -c "import black" > /dev/null 2>&1 || python3 -m pip install black python3 -m black . python3 -c "import ruff" > /dev/null 2>&1 || python3 -m pip install ruff - python3 -m ruff --fix . + python3 -m ruff check --fix . .PHONY: mypy mypy: diff --git a/depends/install_imagequant.sh b/depends/install_imagequant.sh index 060d9840ec9..8d62d5ac733 100755 --- a/depends/install_imagequant.sh +++ b/depends/install_imagequant.sh @@ -23,19 +23,14 @@ else cargo cinstall --prefix=/usr --destdir=. # Copy into place - if [ -d "usr/lib64" ]; then - lib="lib64" - else - lib="lib" - fi - sudo cp usr/$lib/libimagequant.so* /usr/lib/ + sudo find usr -name libimagequant.so* -exec cp {} /usr/lib/ \; sudo cp usr/include/libimagequant.h /usr/include/ if [ -n "$GITHUB_ACTIONS" ]; then # Copy to cache rm -rf ~/cache-$archive_name mkdir ~/cache-$archive_name - cp usr/lib/libimagequant.so* ~/cache-$archive_name/ + find usr -name libimagequant.so* -exec cp {} ~/cache-$archive_name/ \; cp usr/include/libimagequant.h ~/cache-$archive_name/ fi diff --git a/pyproject.toml b/pyproject.toml index 228c344e864..0d0a6f17084 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,9 +97,13 @@ config-settings = "raqm=enable raqm=vendor fribidi=vendor imagequant=disable" test-command = "cd {project} && .github/workflows/wheels-test.sh" test-extras = "tests" +[tool.black] +exclude = "wheels/multibuild" + [tool.ruff] -fix = true +exclude = [ "wheels/multibuild" ] +fix = true lint.select = [ "C4", # flake8-comprehensions "E", # pycodestyle errors diff --git a/src/libImaging/Geometry.c b/src/libImaging/Geometry.c index 84aa442f067..1e2abd7e75c 100644 --- a/src/libImaging/Geometry.c +++ b/src/libImaging/Geometry.c @@ -791,15 +791,15 @@ ImagingGenericTransform( char *out; double xx, yy; + if (!imOut || !imIn || strcmp(imIn->mode, imOut->mode) != 0) { + return (Imaging)ImagingError_ModeError(); + } + ImagingTransformFilter filter = getfilter(imIn, filterid); if (!filter) { return (Imaging)ImagingError_ValueError("bad filter number"); } - if (!imOut || !imIn || strcmp(imIn->mode, imOut->mode) != 0) { - return (Imaging)ImagingError_ModeError(); - } - ImagingCopyPalette(imOut, imIn); ImagingSectionEnter(&cookie);