mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-21 05:04:00 +00:00
63 lines
2.2 KiB
Nix
63 lines
2.2 KiB
Nix
{ stdenv, buildPythonPackage, fetchPypi, isPyPy,
|
|
nose, olefile,
|
|
freetype, libjpeg, zlib, libtiff, libwebp, tcl, lcms2, tk, libX11}:
|
|
buildPythonPackage rec {
|
|
pname = "Pillow";
|
|
version = "4.3.0";
|
|
name = "${pname}-${version}";
|
|
|
|
src = fetchPypi {
|
|
inherit pname version;
|
|
sha256 = "a97c715d44efd5b4aa8d739b8fad88b93ed79f1b33fc2822d5802043f3b1b527";
|
|
};
|
|
|
|
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 ];
|
|
};
|
|
}
|