summary refs log tree commit diff
path: root/pkgs/development/python-modules/imageio/default.nix
blob: de8380280670bd735a38538809f1c345c0a93710 (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
46
47
{ stdenv
, buildPythonPackage
, fetchPypi
, pillow
, psutil
, pytest
, numpy
, isPy3k
, futures
, enum34
}:

buildPythonPackage rec {
  pname = "imageio";
  version = "2.4.1";

  src = fetchPypi {
    sha256 = "0jjiwf6wjipmykh33prjh448qv8mpgngfi77ndc7mym5r1xhgf0n";
    inherit pname version;
  };

  checkInputs = [ pytest psutil ];
  propagatedBuildInputs = [ numpy pillow ] ++ stdenv.lib.optionals (!isPy3k) [
    futures
    enum34
  ];

  checkPhase = ''
    export IMAGEIO_USERDIR="$TMP"
    export IMAGEIO_NO_INTERNET="true"
    export HOME="$(mktemp -d)"
    py.test
  '';

  # For some reason, importing imageio also imports xml on Nix, see
  # https://github.com/imageio/imageio/issues/395
  postPatch = ''
    substituteInPlace tests/test_meta.py --replace '"urllib",' "\"urllib\",\"xml\""
  '';

  meta = with stdenv.lib; {
    description = "Library for reading and writing a wide range of image, video, scientific, and volumetric data formats";
    homepage = http://imageio.github.io/;
    license = licenses.bsd2;
  };

}