nixpkgs/pkgs/development/python-modules/imageio/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

56 lines
1.3 KiB
Nix

{ lib, stdenv
, buildPythonPackage
, isPy27
, pathlib
, fetchPypi
, pillow
, psutil
, imageio-ffmpeg
, pytest
, numpy
, isPy3k
, ffmpeg_3
, futures
, enum34
}:
buildPythonPackage rec {
pname = "imageio";
version = "2.9.0";
disabled = isPy27;
src = fetchPypi {
sha256 = "52ddbaeca2dccf53ba2d6dec5676ca7bc3b2403ef8b37f7da78b7654bb3e10f0";
inherit pname version;
};
checkInputs = [ pytest psutil ] ++ stdenv.lib.optionals isPy3k [
imageio-ffmpeg ffmpeg_3
];
propagatedBuildInputs = [ numpy pillow ];
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
# 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; {
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;
};
}