summary refs log tree commit diff
path: root/pkgs/development/python-modules/pil/default.nix
blob: 35a1e913bf7bce7bcc29cf2b72c5e742a4ebdb1b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{ fetchurl, stdenv, python, buildPythonPackage, libjpeg, zlib, freetype }:

let version = "1.1.7"; in

buildPythonPackage {
  name = "imaging-${version}";
  
  src = fetchurl {
    url = "http://effbot.org/downloads/Imaging-${version}.tar.gz";
    sha256 = "04aj80jhfbmxqzvmq40zfi4z3cw6vi01m3wkk6diz3lc971cfnw9";
  };

  buildInputs = [ python libjpeg zlib freetype ];

  doCheck = true;

  preConfigure = ''
    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 ;'
  '';

  checkPhase   = "python selftest.py";
  buildPhase   = "python setup.py build_ext -i";

  postInstall = ''
    cd "$out"/lib/python*/site-packages
    ln -s $PWD PIL
  '';

  meta = {
    homepage = http://www.pythonware.com/products/pil/;
    description = "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";
  };
}