python3Packages.imageio: refactor

This commit is contained in:
Robert Schütz 2021-04-30 12:30:34 +02:00
parent b639c57aaa
commit e95bdd6b3c

View file

@ -1,17 +1,12 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, isPy27 , isPy27
, pathlib
, fetchPypi , fetchPypi
, imageio-ffmpeg
, numpy
, pillow , pillow
, psutil , psutil
, imageio-ffmpeg , pytestCheckHook
, pytest
, numpy
, isPy3k
, ffmpeg_3
, futures ? null
, enum34
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -24,26 +19,21 @@ buildPythonPackage rec {
inherit pname version; inherit pname version;
}; };
checkInputs = [ pytest psutil ] ++ lib.optionals isPy3k [ propagatedBuildInputs = [
imageio-ffmpeg ffmpeg_3 imageio-ffmpeg
]; numpy
propagatedBuildInputs = [ numpy pillow ]; pillow
];
checkPhase = '' checkInputs = [
psutil
pytestCheckHook
];
preCheck = ''
export IMAGEIO_USERDIR="$TMP" export IMAGEIO_USERDIR="$TMP"
export IMAGEIO_NO_INTERNET="true" export IMAGEIO_NO_INTERNET="true"
export HOME="$(mktemp -d)" export HOME="$(mktemp -d)"
py.test
'';
# For some reason, importing imageio also imports xml on Nix, see
# https://github.com/imageio/imageio/issues/395
# Also, there are tests that test the downloading of ffmpeg if it's not installed.
# "Uncomment" those by renaming.
postPatch = ''
substituteInPlace tests/test_meta.py --replace '"urllib",' "\"urllib\",\"xml\","
substituteInPlace tests/test_ffmpeg.py --replace 'test_get_exe_installed' 'get_exe_installed'
''; '';
meta = with lib; { meta = with lib; {
@ -51,5 +41,4 @@ buildPythonPackage rec {
homepage = "http://imageio.github.io/"; homepage = "http://imageio.github.io/";
license = licenses.bsd2; license = licenses.bsd2;
}; };
} }