diff options
author | adisbladis <adisbladis@gmail.com> | 2020-06-07 00:44:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-07 00:44:23 +0200 |
commit | 243cfc5769afa9f2935f88fc8328389c16314f42 (patch) | |
tree | 519dc1346652af35abbe712e44831083ca688bf3 /pkgs/development/python-modules | |
parent | c5acf2738ead2360611d81bba0a49442ceea3c9b (diff) | |
parent | 7abf70b244b7a0d599729a6ae2222b81cb861704 (diff) | |
download | nixlib-243cfc5769afa9f2935f88fc8328389c16314f42.tar nixlib-243cfc5769afa9f2935f88fc8328389c16314f42.tar.gz nixlib-243cfc5769afa9f2935f88fc8328389c16314f42.tar.bz2 nixlib-243cfc5769afa9f2935f88fc8328389c16314f42.tar.lz nixlib-243cfc5769afa9f2935f88fc8328389c16314f42.tar.xz nixlib-243cfc5769afa9f2935f88fc8328389c16314f42.tar.zst nixlib-243cfc5769afa9f2935f88fc8328389c16314f42.zip |
Merge pull request #89588 from jonringer/freeze-piillow-py2
python2Packages.pillow: freeze at 6.2.2
Diffstat (limited to 'pkgs/development/python-modules')
-rw-r--r-- | pkgs/development/python-modules/pillow/6.nix | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/pillow/6.nix b/pkgs/development/python-modules/pillow/6.nix new file mode 100644 index 000000000000..ad69f4f23450 --- /dev/null +++ b/pkgs/development/python-modules/pillow/6.nix @@ -0,0 +1,82 @@ +{ stdenv, buildPythonPackage, fetchPypi, isPyPy +, olefile +, freetype, libjpeg, zlib, libtiff, libwebp, tcl, lcms2, tk, libX11 +, openjpeg, libimagequant +, pytest, pytestrunner, pyroma, numpy +}: + +buildPythonPackage rec { + pname = "Pillow"; + version = "6.2.2"; + + src = fetchPypi { + inherit pname version; + sha256 = "0l5rv8jkdrb5q846v60v03mcq64yrhklidjkgwv6s1pda71g17yv"; + }; + + # 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 + ''; + + checkPhase = '' + runHook preCheck + python -m pytest -v -x -W always + runHook postCheck + ''; + + propagatedBuildInputs = [ olefile ]; + + checkInputs = [ pytest pytestrunner pyroma numpy ]; + + buildInputs = [ + freetype libjpeg openjpeg libimagequant zlib libtiff libwebp tcl lcms2 ] + ++ stdenv.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="-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 ]; + }; +} |