python312Packages.pillow: 10.4.0 -> 11.0.0; python312Packages.pillow-simd: drop (#350832)

This commit is contained in:
Martin Weinelt
2024-10-26 05:14:39 +02:00
committed by GitHub
8 changed files with 160 additions and 240 deletions
+5
View File
@@ -890,6 +890,11 @@ lib.mapAttrs mkLicense ({
fullName = "MIT License";
};
mit-cmu = {
spdxId = "MIT-CMU";
fullName = "CMU License";
};
mit-feh = {
spdxId = "MIT-feh";
fullName = "feh License";
@@ -3,7 +3,6 @@
stdenv,
buildPythonPackage,
fetchFromGitHub,
fetchpatch,
isPyPy,
substituteAll,
@@ -98,15 +97,21 @@ buildPythonPackage rec {
"tests/test_swf.py"
];
disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
# Segmentation fault
"test_bayer_write"
# RuntimeError: No valid H.264 encoder was found with the ffmpeg installation
"test_writer_file_properly_closed"
"test_writer_pixelformat_size_verbose"
"test_writer_ffmpeg_params"
"test_reverse_read"
];
disabledTests =
[
# Pillow 11.0.0 compat
# https://github.com/imageio/imageio/issues/1104
"test_gif"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# Segmentation fault
"test_bayer_write"
# RuntimeError: No valid H.264 encoder was found with the ffmpeg installation
"test_writer_file_properly_closed"
"test_writer_pixelformat_size_verbose"
"test_writer_ffmpeg_params"
"test_reverse_read"
];
meta = {
description = "Library for reading and writing a wide range of image, video, scientific, and volumetric data formats";
@@ -28,14 +28,14 @@
buildPythonPackage rec {
pname = "pillow-heif";
version = "0.18.0";
version = "0.20.0";
pyproject = true;
src = fetchFromGitHub {
owner = "bigcat88";
repo = "pillow_heif";
rev = "refs/tags/v${version}";
hash = "sha256-+HQvDf5aovUtZ++BoD22B012N32A+7++O/jbpkIVQws=";
hash = "sha256-a1qCxI+mMuEYsCk2CUYGNKCe+SONuvVizqUvmQKy3sE=";
};
postPatch = ''
@@ -1,63 +0,0 @@
{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
isPyPy,
isPy3k,
olefile,
freetype,
libjpeg,
zlib,
libtiff,
libwebp,
libxcrypt,
tcl,
lcms2,
libxcb,
tk,
libX11,
openjpeg,
libimagequant,
pyroma,
numpy,
defusedxml,
pytestCheckHook,
setuptools,
}@args:
import ../pillow/generic.nix (
rec {
pname = "Pillow-SIMD";
# check for release version on https://pypi.org/project/Pillow-SIMD/#history
# does not match the latest pillow release version!
version = "9.0.0.post1";
format = "setuptools";
disabled = !isPy3k;
src = fetchFromGitHub {
owner = "uploadcare";
repo = "pillow-simd";
rev = "v${version}";
hash = "sha256-qTZYhgHjVMXqoYl3mG1xVrFaWrPidSY8HlyFQizV27Y=";
};
meta = with lib; {
broken =
(stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) || stdenv.hostPlatform.isDarwin;
homepage = "https://python-pillow.github.io/pillow-perf/";
description = "Friendly PIL fork - SIMD version";
longDescription = ''
Pillow-SIMD is "following" Pillow. Pillow-SIMD versions are 100% compatible drop-in replacements for Pillow of the same version.
SIMD stands for "single instruction, multiple data" and its essence is in performing the same operation on multiple data points simultaneously by using multiple processing elements. Common CPU SIMD instruction sets are MMX, SSE-SSE4, AVX, AVX2, AVX512, NEON.
Currently, Pillow-SIMD can be compiled with SSE4 (default) or AVX2 support.
'';
license = licenses.hpnd;
maintainers = [ ];
};
}
// args
)
@@ -3,26 +3,35 @@
stdenv,
buildPythonPackage,
pythonOlder,
fetchPypi,
isPyPy,
defusedxml,
olefile,
fetchFromGitHub,
# build-system
setuptools,
pkg-config,
# native dependencies
freetype,
lcms2,
libimagequant,
libjpeg,
zlib,
libraqm,
libtiff,
libwebp,
libxcrypt,
tcl,
lcms2,
tk,
libX11,
libxcb,
openjpeg,
libimagequant,
tkinter,
zlib,
# optional dependencies
defusedxml,
olefile,
typing-extensions,
# tests
numpy,
pytest-cov-stub,
pytestCheckHook,
setuptools,
# for passthru.tests
imageio,
matplotlib,
@@ -30,45 +39,112 @@
pydicom,
reportlab,
sage,
}@args:
}:
import ./generic.nix (
rec {
pname = "pillow";
version = "10.4.0";
format = "pyproject";
buildPythonPackage rec {
pname = "pillow";
version = "11.0.0";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "python-pillow";
repo = "pillow";
rev = "refs/tags/${version}";
hash = "sha256-vWNqzA2ZfJcWexXw790RgyYtP8WDtahoQIX16otCRnk=";
};
src = fetchPypi {
pname = "pillow";
inherit version;
hash = "sha256-Fmwc1NJDCbMNYfefSpEUt7IxPXRQkSJ3hV/139fNSgY=";
};
build-system = [ setuptools ];
passthru.tests = {
inherit
imageio
matplotlib
pilkit
pydicom
reportlab
sage
;
};
nativeBuildInputs = [ pkg-config ];
meta = with lib; {
homepage = "https://python-pillow.org/";
description = "Friendly PIL fork (Python Imaging Library)";
longDescription = ''
The Python Imaging Library (PIL) adds image processing
capabilities to your Python interpreter. This library
supports many file formats, and provides powerful image
processing and graphics capabilities.
'';
license = licenses.hpnd;
maintainers = with maintainers; [ prikhi ];
};
}
// args
)
# https://pillow.readthedocs.io/en/latest/installation/building-from-source.html#building-from-source
buildInputs = [
freetype
lcms2
libimagequant
libjpeg
libraqm
libtiff
libwebp
libxcb
openjpeg
tkinter
zlib
];
pypaBuildFlags = [
# Disable platform guessing, which tries various FHS paths
"--config=setting=--disable-platform-guessing"
];
preConfigure =
let
getLibAndInclude = pkg: ''"${pkg.out}/lib", "${lib.getDev pkg}/include"'';
in
''
# The build process fails to find the pkg-config files for these dependencies
substituteInPlace setup.py \
--replace-fail 'IMAGEQUANT_ROOT = None' 'IMAGEQUANT_ROOT = ${getLibAndInclude libimagequant}' \
--replace-fail 'JPEG2K_ROOT = None' 'JPEG2K_ROOT = ${getLibAndInclude openjpeg}'
# Build with X11 support
export LDFLAGS="$LDFLAGS -L${libxcb}/lib"
export CFLAGS="$CFLAGS -I${libxcb.dev}/include"
'';
optional-dependencies = {
fpx = [ olefile ];
mic = [ olefile ];
typing = lib.optionals (pythonOlder "3.10") [ typing-extensions ];
xmp = [ defusedxml ];
};
nativeCheckInputs = [
pytest-cov-stub
pytestCheckHook
numpy
] ++ lib.flatten (lib.attrValues optional-dependencies);
disabledTests =
[
# Code quality mismathch 9 vs 10
"test_pyroma"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# Disable darwin tests which require executables: `iconutil` and `screencapture`
"test_grab"
"test_grabclipboard"
"test_save"
];
disabledTestPaths = lib.optionals stdenv.isDarwin [
# Crashes the interpreter
"Tests/test_imagetk.py"
];
passthru.tests = {
inherit
imageio
matplotlib
pilkit
pydicom
reportlab
sage
;
};
meta = with lib; {
homepage = "https://python-pillow.org";
changelog = "https://pillow.readthedocs.io/en/stable/releasenotes/${version}.html";
description = "Friendly PIL fork (Python Imaging Library)";
longDescription = ''
The Python Imaging Library (PIL) adds image processing
capabilities to your Python interpreter. This library
supports many file formats, and provides powerful image
processing and graphics capabilities.
'';
license = licenses.mit-cmu;
maintainers = with maintainers; [ hexa ];
};
}
@@ -1,109 +0,0 @@
{
pname,
version,
src,
patches ? [ ],
meta,
passthru ? { },
...
}@args:
with args;
buildPythonPackage rec {
inherit
pname
version
format
src
meta
passthru
patches
;
# Disable imagefont tests, because they don't work well with infinality:
# https://github.com/python-pillow/Pillow/issues/1259
postPatch = ''
rm Tests/test_imagefont.py
'';
disabledTests =
[
# Code quality mismathch 9 vs 10
"test_pyroma"
# pillow-simd
"test_roundtrip"
"test_basic"
"test_custom_metadata"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# Disable darwin tests which require executables: `iconutil` and `screencapture`
"test_grab"
"test_grabclipboard"
"test_save"
];
propagatedBuildInputs = [
olefile
] ++ lib.optionals (lib.versionAtLeast version "8.2.0") [ defusedxml ];
nativeCheckInputs = [
pytestCheckHook
numpy
];
nativeBuildInputs = [ setuptools ];
buildInputs =
[
freetype
libjpeg
openjpeg
libimagequant
zlib
libtiff
libwebp
libxcrypt
tcl
lcms2
]
++ lib.optionals (lib.versionAtLeast version "7.1.0") [ libxcb ]
++ lib.optionals (isPyPy) [
tk
libX11
];
# NOTE: we use LCMS_ROOT as WEBP root since there is not other setting for webp.
# NOTE: The Pillow install script will, by default, add paths like /usr/lib
# and /usr/include to the search paths. This can break things when building
# on a non-NixOS system that has some libraries installed that are not
# installed in Nix (for example, Arch Linux has jpeg2000 but Nix doesn't
# build Pillow with this support). We patch the `disable_platform_guessing`
# setting here, instead of passing the `--disable-platform-guessing`
# command-line option, since the command-line option doesn't work when we run
# tests.
preConfigure =
let
libinclude' = pkg: ''"${pkg.out}/lib", "${pkg.out}/include"'';
libinclude = pkg: ''"${pkg.out}/lib", "${pkg.dev}/include"'';
in
''
sed -i "setup.py" \
-e 's|^FREETYPE_ROOT =.*$|FREETYPE_ROOT = ${libinclude freetype}|g ;
s|^JPEG_ROOT =.*$|JPEG_ROOT = ${libinclude libjpeg}|g ;
s|^JPEG2K_ROOT =.*$|JPEG2K_ROOT = ${libinclude openjpeg}|g ;
s|^IMAGEQUANT_ROOT =.*$|IMAGEQUANT_ROOT = ${libinclude' libimagequant}|g ;
s|^ZLIB_ROOT =.*$|ZLIB_ROOT = ${libinclude zlib}|g ;
s|^LCMS_ROOT =.*$|LCMS_ROOT = ${libinclude lcms2}|g ;
s|^TIFF_ROOT =.*$|TIFF_ROOT = ${libinclude libtiff}|g ;
s|^TCL_ROOT=.*$|TCL_ROOT = ${libinclude' tcl}|g ;
s|self\.disable_platform_guessing = None|self.disable_platform_guessing = True|g ;'
export LDFLAGS="$LDFLAGS -L${libwebp}/lib"
export CFLAGS="$CFLAGS -I${libwebp}/include"
''
+ lib.optionalString (lib.versionAtLeast version "7.1.0") ''
export LDFLAGS="$LDFLAGS -L${libxcb}/lib"
export CFLAGS="$CFLAGS -I${libxcb.dev}/include"
'';
}
+1
View File
@@ -403,6 +403,7 @@ mapAliases ({
pdfminer = pdfminer-six; # added 2022-05-25
pdfx = throw "pdfx has been removed because the upstream repository was archived in 2023"; # Added 2024-10-04
pep257 = pydocstyle; # added 2022-04-12
pillow-simd = throw "pillow-simd has been removed for lagging behind pillow upstream, which exposes it to various security issues."; # Added 2024-10-24
pixelmatch = "pixelmatch has been removed as it was unmaintained"; # Added 2024-08-18
pkutils = throw "pkutils was removed as it was unused and is not applicable to modern Python build tools"; # added 2024-07-28
poetry = throw "poetry was promoted to a top-level attribute, use poetry-core to build Python packages"; # added 2023-01-09
+12 -7
View File
@@ -10071,19 +10071,24 @@ self: super: with self; {
pillowfight = callPackage ../development/python-modules/pillowfight { };
pillow = callPackage ../development/python-modules/pillow {
inherit (pkgs) freetype libjpeg zlib libtiff libwebp tcl lcms2 tk;
inherit (pkgs.xorg) libX11 libxcb;
inherit (pkgs)
freetype
lcms2
libimagequant
libjpeg
libraqm
libtiff
libwebp
openjpeg
zlib
;
inherit (pkgs.xorg) libxcb;
};
pillow-heif = callPackage ../development/python-modules/pillow-heif { };
pillow-jpls = callPackage ../development/python-modules/pillow-jpls { };
pillow-simd = callPackage ../development/python-modules/pillow-simd {
inherit (pkgs) freetype libjpeg zlib libtiff libwebp tcl lcms2 tk;
inherit (pkgs.xorg) libX11;
};
pims = callPackage ../development/python-modules/pims { };
pinboard = callPackage ../development/python-modules/pinboard { };