1{ stdenv
2, buildPythonPackage
3, isPy27
4, pathlib
5, fetchPypi
6, pillow
7, psutil
8, imageio-ffmpeg
9, pytest
10, numpy
11, isPy3k
12, ffmpeg_3
13, futures
14, enum34
15}:
16
17buildPythonPackage rec {
18 pname = "imageio";
19 version = "2.9.0";
20 disabled = isPy27;
21
22 src = fetchPypi {
23 sha256 = "52ddbaeca2dccf53ba2d6dec5676ca7bc3b2403ef8b37f7da78b7654bb3e10f0";
24 inherit pname version;
25 };
26
27 checkInputs = [ pytest psutil ] ++ stdenv.lib.optionals isPy3k [
28 imageio-ffmpeg ffmpeg_3
29 ];
30 propagatedBuildInputs = [ numpy pillow ];
31
32 checkPhase = ''
33 export IMAGEIO_USERDIR="$TMP"
34 export IMAGEIO_NO_INTERNET="true"
35 export HOME="$(mktemp -d)"
36 py.test
37 '';
38
39 # For some reason, importing imageio also imports xml on Nix, see
40 # https://github.com/imageio/imageio/issues/395
41
42 # Also, there are tests that test the downloading of ffmpeg if it's not installed.
43 # "Uncomment" those by renaming.
44 postPatch = ''
45 substituteInPlace tests/test_meta.py --replace '"urllib",' "\"urllib\",\"xml\","
46 substituteInPlace tests/test_ffmpeg.py --replace 'test_get_exe_installed' 'get_exe_installed'
47 '';
48
49 meta = with stdenv.lib; {
50 description = "Library for reading and writing a wide range of image, video, scientific, and volumetric data formats";
51 homepage = "http://imageio.github.io/";
52 license = licenses.bsd2;
53 };
54
55}