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