Skip to content

Commit

Permalink
Merge branch 'main' into resize_i16
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere authored Sep 30, 2024
2 parents d33270a + 7e6e08e commit 42ad42c
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 44 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/cifuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 11 additions & 25 deletions .github/workflows/wheels-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
6 changes: 3 additions & 3 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 2 additions & 7 deletions depends/install_imagequant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/libImaging/Geometry.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 42ad42c

Please sign in to comment.