diff options
author | Alyssa Ross <hi@alyssa.is> | 2020-07-13 23:20:04 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2020-07-13 23:21:06 +0000 |
commit | a42c1d6d62656dcf9bd85de620f2e200a5ad22d8 (patch) | |
tree | 7d481fea9872f62a034452612be17f4494159baa /nixpkgs/pkgs/development/python-modules/pillow | |
parent | 55f69a6b0e53c1c4b3e0396937c53bf5662b5519 (diff) | |
parent | 9480bae337095fd24f61380bce3174fdfe926a00 (diff) | |
download | nixlib-a42c1d6d62656dcf9bd85de620f2e200a5ad22d8.tar nixlib-a42c1d6d62656dcf9bd85de620f2e200a5ad22d8.tar.gz nixlib-a42c1d6d62656dcf9bd85de620f2e200a5ad22d8.tar.bz2 nixlib-a42c1d6d62656dcf9bd85de620f2e200a5ad22d8.tar.lz nixlib-a42c1d6d62656dcf9bd85de620f2e200a5ad22d8.tar.xz nixlib-a42c1d6d62656dcf9bd85de620f2e200a5ad22d8.tar.zst nixlib-a42c1d6d62656dcf9bd85de620f2e200a5ad22d8.zip |
Merge commit '9480bae337095fd24f61380bce3174fdfe926a00'
This is the last nixos-unstable release before 13b2903169f, which I'm a bit nervous about. So I want the update including that one to be as small as possible, hence going to this one first.
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/pillow')
-rw-r--r-- | nixpkgs/pkgs/development/python-modules/pillow/6.nix | 82 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/python-modules/pillow/default.nix | 27 |
2 files changed, 99 insertions, 10 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/pillow/6.nix b/nixpkgs/pkgs/development/python-modules/pillow/6.nix new file mode 100644 index 000000000000..ad69f4f23450 --- /dev/null +++ b/nixpkgs/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 ]; + }; +} diff --git a/nixpkgs/pkgs/development/python-modules/pillow/default.nix b/nixpkgs/pkgs/development/python-modules/pillow/default.nix index 4e8a47569b7e..cc9a77be7827 100644 --- a/nixpkgs/pkgs/development/python-modules/pillow/default.nix +++ b/nixpkgs/pkgs/development/python-modules/pillow/default.nix @@ -1,32 +1,37 @@ { stdenv, buildPythonPackage, fetchPypi, isPyPy , olefile , freetype, libjpeg, zlib, libtiff, libwebp, tcl, lcms2, tk, libX11 -, pytestrunner -, pytest +, openjpeg, libimagequant +, pyroma, numpy, pytestCheckHook +, isPy3k }: + buildPythonPackage rec { pname = "Pillow"; - version = "6.2.2"; + version = "7.1.2"; + + disabled = !isPy3k; src = fetchPypi { inherit pname version; - sha256 = "db9ff0c251ed066d367f53b64827cc9e18ccea001b986d08c265e53625dab950"; + sha256 = "1pdh1zzdwxilvsjg6rnl4q810pc2p2y16q6lx9gzzihb25h9kd50"; }; - 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 ''; + # Disable darwin tests which require executables: `iconutil` and `screencapture` + disabledTests = stdenv.lib.optionals stdenv.isDarwin [ "test_save" "test_grab" "test_grabclipboard" ]; + propagatedBuildInputs = [ olefile ]; - checkInputs = [ pytest pytestrunner ]; + checkInputs = [ pytestCheckHook pyroma numpy ]; buildInputs = [ - freetype libjpeg zlib libtiff libwebp tcl lcms2 ] + 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. @@ -45,6 +50,8 @@ buildPythonPackage rec { 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 ; @@ -61,8 +68,8 @@ buildPythonPackage rec { ''; meta = with stdenv.lib; { - homepage = "https://python-pillow.github.io/"; - description = "Fork of The Python Imaging Library (PIL)"; + 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 |