nixpkgs/pkgs/development/python-modules/imgaug/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

60 lines
1.2 KiB
Nix

{ buildPythonPackage
, fetchFromGitHub
, imageio
, imagecorruptions
, numpy
, opencv3
, pytest
, scikitimage
, scipy
, shapely
, six
, lib, stdenv
}:
buildPythonPackage rec {
pname = "imgaug";
version = "0.4.0";
src = fetchFromGitHub {
owner = "aleju";
repo = "imgaug";
rev = version;
sha256 = "17hbxndxphk3bfnq35y805adrfa6gnm5x7grjxbwdw4kqmbbqzah";
};
postPatch = ''
substituteInPlace requirements.txt \
--replace "opencv-python-headless" ""
substituteInPlace setup.py \
--replace "opencv-python-headless" ""
substituteInPlace pytest.ini \
--replace "--xdoctest --xdoctest-global-exec=\"import imgaug as ia\nfrom imgaug import augmenters as iaa\"" ""
'';
propagatedBuildInputs = [
imageio
imagecorruptions
numpy
opencv3
scikitimage
scipy
shapely
six
];
checkPhase = ''
pytest ./test
'';
checkInputs = [ opencv3 pytest ];
meta = with lib; {
homepage = "https://github.com/aleju/imgaug";
description = "Image augmentation for machine learning experiments";
license = licenses.mit;
maintainers = with maintainers; [ cmcdragonkai rakesh4g ];
platforms = platforms.linux;
};
}