From a8dd4d8e538fbb6fea9e2e0af14f057817d53d72 Mon Sep 17 00:00:00 2001 From: Lancelot SIX Date: Wed, 12 Jul 2017 12:28:55 +0200 Subject: [PATCH] pythonPackages.pillow: 3.4.2 -> 4.2.1 --- .../python-modules/pillow/default.nix | 62 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 58 +---------------- 2 files changed, 65 insertions(+), 55 deletions(-) create mode 100644 pkgs/development/python-modules/pillow/default.nix diff --git a/pkgs/development/python-modules/pillow/default.nix b/pkgs/development/python-modules/pillow/default.nix new file mode 100644 index 000000000000..0fbb36b3c196 --- /dev/null +++ b/pkgs/development/python-modules/pillow/default.nix @@ -0,0 +1,62 @@ +{ stdenv, buildPythonPackage, fetchPypi, isPyPy, + nose, olefile, + freetype, libjpeg, zlib, libtiff, libwebp, tcl, lcms2, tk, libX11}: +buildPythonPackage rec { + pname = "Pillow"; + version = "4.2.1"; + name = "${pname}-${version}"; + + src = fetchPypi { + inherit pname version; + sha256 = "0wq0fiw964bj5rdmw66mhbfsjnmb13bcdr42krpk2ig5f1cgc967"; + }; + + doCheck = !stdenv.isDarwin && !isPyPy; + + # 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 + ''; + + propagatedBuildInputs = [ olefile ]; + + buildInputs = [ + freetype libjpeg zlib libtiff libwebp tcl nose lcms2 ] + ++ stdenv.lib.optionals (isPyPy) [ tk libX11 ]; + + # NOTE: we use LCMS_ROOT as WEBP root since there is not other setting for webp. + 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|^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 ;' + export LDFLAGS="-L${libwebp}/lib" + export CFLAGS="-I${libwebp}/include" + '' + # Remove impurities + + stdenv.lib.optionalString stdenv.isDarwin '' + substituteInPlace setup.py \ + --replace '"/Library/Frameworks",' "" \ + --replace '"/System/Library/Frameworks"' "" + ''; + + meta = with stdenv.lib; { + homepage = "https://python-pillow.github.io/"; + description = "Fork of The Python Imaging Library (PIL)"; + 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 = "http://www.pythonware.com/products/pil/license.htm"; + maintainers = with maintainers; [ goibhniu prikhi ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index dd41361916d2..14945f722993 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -17612,61 +17612,9 @@ in { pystringtemplate = callPackage ../development/python-modules/stringtemplate { }; - pillow = buildPythonPackage rec { - name = "Pillow-${version}"; - version = "3.4.2"; - - src = pkgs.fetchurl { - url = "mirror://pypi/P/Pillow/${name}.tar.gz"; - sha256 = "0ee9975c05602e755ff5000232e0335ba30d507f6261922a658ee11b1cec36d1"; - }; - - doCheck = !stdenv.isDarwin && !isPyPy; - - # 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 - ''; - - buildInputs = with self; [ - pkgs.freetype pkgs.libjpeg pkgs.zlib pkgs.libtiff pkgs.libwebp pkgs.tcl nose pkgs.lcms2 ] - ++ optionals (isPyPy) [ pkgs.tk pkgs.xorg.libX11 ]; - - # NOTE: we use LCMS_ROOT as WEBP root since there is not other setting for webp. - 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 pkgs.freetype}|g ; - s|^JPEG_ROOT =.*$|JPEG_ROOT = ${libinclude pkgs.libjpeg}|g ; - s|^ZLIB_ROOT =.*$|ZLIB_ROOT = ${libinclude pkgs.zlib}|g ; - s|^LCMS_ROOT =.*$|LCMS_ROOT = ${libinclude pkgs.lcms2}|g ; - s|^TIFF_ROOT =.*$|TIFF_ROOT = ${libinclude pkgs.libtiff}|g ; - s|^TCL_ROOT=.*$|TCL_ROOT = ${libinclude' pkgs.tcl}|g ;' - export LDFLAGS="-L${pkgs.libwebp}/lib" - export CFLAGS="-I${pkgs.libwebp}/include" - '' - # Remove impurities - + stdenv.lib.optionalString stdenv.isDarwin '' - substituteInPlace setup.py \ - --replace '"/Library/Frameworks",' "" \ - --replace '"/System/Library/Frameworks"' "" - ''; - - meta = { - homepage = "https://python-pillow.github.io/"; - description = "Fork of The Python Imaging Library (PIL)"; - 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 = "http://www.pythonware.com/products/pil/license.htm"; - maintainers = with maintainers; [ goibhniu prikhi ]; - }; + pillow = callPackage ../development/python-modules/pillow { + inherit (pkgs) freetype libjpeg zlib libtiff libwebp tcl lcms2 tk; + inherit (pkgs.xorg) libX11; }; pkgconfig = buildPythonPackage rec {