about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pillow
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/pillow')
-rw-r--r--pkgs/development/python-modules/pillow/default.nix104
-rw-r--r--pkgs/development/python-modules/pillow/generic.nix126
2 files changed, 147 insertions, 83 deletions
diff --git a/pkgs/development/python-modules/pillow/default.nix b/pkgs/development/python-modules/pillow/default.nix
index f101d6b361ec1..b5257f5101d2c 100644
--- a/pkgs/development/python-modules/pillow/default.nix
+++ b/pkgs/development/python-modules/pillow/default.nix
@@ -1,42 +1,74 @@
-{ lib
-, stdenv
-, buildPythonPackage
-, pythonOlder
-, fetchPypi
-, isPyPy
-, defusedxml, olefile, freetype, libjpeg, zlib, libtiff, libwebp, libxcrypt, tcl, lcms2, tk, libX11
-, libxcb, openjpeg, libimagequant, numpy, pytestCheckHook, setuptools
-# for passthru.tests
-, imageio, matplotlib, pilkit, pydicom, reportlab
+{
+  lib,
+  stdenv,
+  buildPythonPackage,
+  pythonOlder,
+  fetchPypi,
+  isPyPy,
+  defusedxml,
+  olefile,
+  freetype,
+  libjpeg,
+  zlib,
+  libtiff,
+  libwebp,
+  libxcrypt,
+  tcl,
+  lcms2,
+  tk,
+  libX11,
+  libxcb,
+  openjpeg,
+  libimagequant,
+  numpy,
+  pytestCheckHook,
+  setuptools,
+  # for passthru.tests
+  imageio,
+  matplotlib,
+  pilkit,
+  pydicom,
+  reportlab,
+  sage,
 }@args:
 
-import ./generic.nix (rec {
-  pname = "pillow";
-  version = "10.2.0";
-  format = "pyproject";
+import ./generic.nix (
+  rec {
+    pname = "pillow";
+    version = "10.4.0";
+    format = "pyproject";
 
-  disabled = pythonOlder "3.8";
+    disabled = pythonOlder "3.8";
 
-  src = fetchPypi {
-    pname = "pillow";
-    inherit version;
-    hash = "sha256-6H8LLHgVfhLXaGsn1jwHD9ZdmU6N2ubzKODc9KDNAH4=";
-  };
+    src = fetchPypi {
+      pname = "pillow";
+      inherit version;
+      hash = "sha256-Fmwc1NJDCbMNYfefSpEUt7IxPXRQkSJ3hV/139fNSgY=";
+    };
 
-  passthru.tests = {
-    inherit imageio matplotlib pilkit pydicom reportlab;
-  };
+    passthru.tests = {
+      inherit
+        imageio
+        matplotlib
+        pilkit
+        pydicom
+        reportlab
+        sage
+        ;
+    };
 
-  meta = with lib; {
-    homepage = "https://python-pillow.org/";
-    description = "The 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; [ goibhniu prikhi ];
-  };
-} // args )
+    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
+)
diff --git a/pkgs/development/python-modules/pillow/generic.nix b/pkgs/development/python-modules/pillow/generic.nix
index 33276d3abd08e..36fe5b0421fed 100644
--- a/pkgs/development/python-modules/pillow/generic.nix
+++ b/pkgs/development/python-modules/pillow/generic.nix
@@ -1,17 +1,25 @@
-{ pname
-, version
-, disabled
-, src
-, patches ? []
-, meta
-, passthru ? {}
-, ...
+{
+  pname,
+  version,
+  src,
+  patches ? [ ],
+  meta,
+  passthru ? { },
+  ...
 }@args:
 
 with args;
 
 buildPythonPackage rec {
-  inherit pname version format src meta passthru patches;
+  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
@@ -19,31 +27,52 @@ buildPythonPackage rec {
     rm Tests/test_imagefont.py
   '';
 
-  disabledTests = [
-    # Code quality mismathch 9 vs 10
-    "test_pyroma"
+  disabledTests =
+    [
+      # Code quality mismathch 9 vs 10
+      "test_pyroma"
 
-    # pillow-simd
-    "test_roundtrip"
-    "test_basic"
-    "test_custom_metadata"
-  ] ++ lib.optionals stdenv.isDarwin [
-    # Disable darwin tests which require executables: `iconutil` and `screencapture`
-    "test_grab"
-    "test_grabclipboard"
-    "test_save"
-  ];
+      # pillow-simd
+      "test_roundtrip"
+      "test_basic"
+      "test_custom_metadata"
+    ]
+    ++ lib.optionals stdenv.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 ];
+  propagatedBuildInputs = [
+    olefile
+  ] ++ lib.optionals (lib.versionAtLeast version "8.2.0") [ defusedxml ];
 
-  nativeCheckInputs = [ pytestCheckHook numpy ];
+  nativeCheckInputs = [
+    pytestCheckHook
+    numpy
+  ];
 
   nativeBuildInputs = [ setuptools ];
 
-  buildInputs = [ freetype libjpeg openjpeg libimagequant zlib libtiff libwebp libxcrypt tcl lcms2 ]
+  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 ];
+    ++ 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
@@ -54,24 +83,27 @@ buildPythonPackage rec {
   # 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"
-  '';
+  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"
+    '';
 }