## START: Set by rpmautospec ## (rpmautospec version 0.8.4) ## RPMAUTOSPEC: autorelease %define autorelease(e:s:pb:n) %{?-p:0.}%{lua: release_number = 1; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} ## END: Set by rpmautospec %global srcname pillow_jxl_plugin Name: python-pillow-jxl-plugin Version: 1.3.7 Release: %autorelease Summary: JPEG XL support for Pillow License: GPL-3.0-or-later URL: https://github.com/Isotr0py/pillow-jpegxl-plugin Source0: https://files.pythonhosted.org/packages/source/p/pillow-jxl-plugin/%{srcname}-%{version}.tar.gz BuildSystem: pyproject BuildOption(install): -l pillow_jxl BuildRequires: gcc-c++ BuildRequires: rust-packaging BuildRequires: pkgconfig(libjxl) >= 0.11 BuildRequires: pkgconfig(libjxl_threads) BuildRequires: highway-devel BuildRequires: brotli-devel BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros BuildRequires: python3-maturin BuildRequires: python3-packaging BuildRequires: python3-pillow BuildRequires: (crate(half/default) >= 2.7.1 with crate(half/default) < 3) BuildRequires: (crate(jpegxl-rs) >= 0.11.2 with crate(jpegxl-rs) < 0.12) BuildRequires: (crate(pyo3/default) >= 0.27.1 with crate(pyo3/default) < 0.28) BuildRequires: (crate(pyo3/extension-module) >= 0.27.1 with crate(pyo3/extension-module) < 0.28) BuildRequires: (crate(pyo3/generate-import-lib) >= 0.27.1 with crate(pyo3/generate-import-lib) < 0.28) %description JPEG XL encoding and decoding support for Pillow, using Rust bindings. This build uses Fedora-packaged Rust crates and system libjxl. %package -n python3-pillow-jxl-plugin Summary: %{summary} %description -n python3-pillow-jxl-plugin JPEG XL encoding and decoding support for Python 3 Pillow. Import pillow_jxl to register the JPEG XL image plugin. %prep %autosetup -n %{srcname}-%{version} # Select upstream's dynamic linking mode instead of bundled libjxl. %{python3} - <<'PYPATCH' from pathlib import Path p = Path('pyproject.toml') s = p.read_text() old = 'features = ["pyo3/extension-module", "vendored"]' assert old in s p.write_text(s.replace(old, 'features = ["pyo3/extension-module", "dynamic"]')) PYPATCH %cargo_prep %generate_buildrequires -p %cargo_generate_buildrequires -f pyo3/extension-module,dynamic %build -p export CARGO_NET_OFFLINE=true export CARGO_BUILD_JOBS=%{_smp_build_ncpus} export RUSTFLAGS="%{build_rustflags}" %check # Test the installed extension, not the unbuilt source package. cd %{_tmppath} PYTHONPATH=%{buildroot}%{python3_sitearch} %{python3} - <<'PYTEST' from io import BytesIO from PIL import Image import pillow_jxl for mode, color in [('RGB', (23, 90, 177)), ('RGBA', (23, 90, 177, 128)), ('L', 91)]: original = Image.new(mode, (16, 16), color) stream = BytesIO() original.save(stream, format='JXL', lossless=True) stream.seek(0) restored = Image.open(stream) restored.load() assert restored.format == 'JXL' assert restored.mode == original.mode assert restored.size == original.size assert restored.tobytes() == original.tobytes() PYTEST %files -n python3-pillow-jxl-plugin -f %{pyproject_files} %license LICENSE %doc README.md %changelog * Mon Oct 19 2026 Gerald Cox - 1.3.8-1 - Initial personal COPR package