diff --git a/CHANGES.rst b/CHANGES.rst index 78c07ef..0791352 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -15,6 +15,20 @@ CHANGELOG ********* +1.0.0 (2024-01-26) +================= + +Features +-------- + +- Added support for Pillow >= 10.1 + +Changes +------- + +- Updated version of ``libheif-rs`` to 1.0. +- Updated version of ``pyo3`` to 0.20. + 0.14 (2023-09-09) ================= diff --git a/Cargo.toml b/Cargo.toml index 1731505..391e74d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,8 +12,8 @@ crate-type = ["cdylib"] [dependencies] -libheif-rs = { version = "0.22.0" } -pyo3 = "0.19.2" +libheif-rs = { version = "1.0" } +pyo3 = "0.20" [profile.release] diff --git a/README.rst b/README.rst index e5bc4eb..5f06805 100644 --- a/README.rst +++ b/README.rst @@ -56,7 +56,7 @@ Installation from source System requirements: -- libheif-dev >= 1.16 (https://github.com/strukturag/libheif) +- libheif-dev >= 1.17 (https://github.com/strukturag/libheif) - python3-dev - Rust 1.72+ (https://www.rust-lang.org/) - CLang diff --git a/docker/Dockerfile b/docker/Dockerfile index bc711d4..8378b66 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -59,7 +59,7 @@ RUN mkdir /workdir "${CARGO_TARGET_DIR}" # libheif: step1 - get sources -ENV LIBHEIF_VERSION 1.16.2 +ENV LIBHEIF_VERSION 1.17.6 RUN set -ex \ && cd /build-deps \ && wget https://github.com/strukturag/libheif/releases/download/v${LIBHEIF_VERSION}/libheif-${LIBHEIF_VERSION}.tar.gz \ @@ -67,9 +67,9 @@ RUN set -ex \ && cd libheif-${LIBHEIF_VERSION} \ && mkdir -p third-party \ && cd third-party \ - && git clone -b 0.6 --depth 1 https://github.com/xiph/rav1e.git \ - && git clone -b 1.2.1 --depth 1 https://code.videolan.org/videolan/dav1d.git \ - && git clone -b v1.3.1 --depth 1 https://chromium.googlesource.com/webm/libwebp + && git clone -b v0.7.1 --depth 1 https://github.com/xiph/rav1e.git \ + && git clone -b 1.3.0 --depth 1 https://code.videolan.org/videolan/dav1d.git \ + && git clone -b v1.3.2 --depth 1 https://chromium.googlesource.com/webm/libwebp # libheif: step2 - rav1e RUN set -ex \ @@ -114,7 +114,7 @@ RUN set -ex \ RUN set -ex \ && source $HOME/.cargo/env \ - && declare -a pythons=("cp38-cp38" "cp39-cp39" "cp310-cp310" "cp311-cp311") \ + && declare -a pythons=("cp38-cp38" "cp39-cp39" "cp310-cp310" "cp311-cp311" "cp312-cp312") \ && for PY in "${pythons[@]}"; do \ cd "/opt/python/${PY}/bin/" \ && ./pip install --upgrade pip auditwheel twine setuptools maturin \ diff --git a/docker/build.sh b/docker/build.sh index 9837bcd..e2c851a 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -28,17 +28,14 @@ rm -rf docker tests build_wheels.sh source "$HOME/.cargo/env" -PYTHONS=("8" "9" "10" "11") +PYTHONS=("8" "9" "10" "11" "12") mkdir "${RESULT}/repaired" SDIST_OPT="--sdist" for PY_MINOR in "${PYTHONS[@]}"; do PY="3${PY_MINOR}" echo "" echo "Build wheel for Python 3.${PY_MINOR}" - PY_BIN_DIR="/opt/python/cp${PY}-cp${PY}m/bin/" - if [ ! -d "${PY_BIN_DIR}" ]; then - PY_BIN_DIR="/opt/python/cp${PY}-cp${PY}/bin/" - fi; + PY_BIN_DIR="/opt/python/cp${PY}-cp${PY}/bin" cd "${WORKDIR}/cykooz-heif" mkdir "${RESULT}/wheelhouse${PY}" PYTHON_SYS_EXECUTABLE="${PY_BIN_DIR}/python" "${PY_BIN_DIR}/maturin" build \ diff --git a/pyproject.toml b/pyproject.toml index f560435..82fa415 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,17 +5,18 @@ build-backend = "maturin" [project] name = "cykooz.heif" -version = "0.14.0" +version = "1.0.0" description = "A decoder of HEIF format of images" readme = "README.rst" classifiers = [ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Rust", "Topic :: Multimedia :: Graphics", diff --git a/python/cykooz/heif/pil.py b/python/cykooz/heif/pil.py index 3684c25..e57f075 100644 --- a/python/cykooz/heif/pil.py +++ b/python/cykooz/heif/pil.py @@ -28,7 +28,11 @@ def _open(self): self._size = raw_heif_image.width, raw_heif_image.height # mode setting - self.mode = raw_heif_image.mode + if hasattr(self, '_mode'): + self._mode = raw_heif_image.mode + else: + # Support Pillow < 10.1.0 + self.mode = raw_heif_image.mode exif = raw_heif_image.exif if exif: