about summary refs log tree commit diff
path: root/pkgs/development/python-modules/batchgenerators/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/batchgenerators/default.nix')
-rw-r--r--pkgs/development/python-modules/batchgenerators/default.nix46
1 files changed, 36 insertions, 10 deletions
diff --git a/pkgs/development/python-modules/batchgenerators/default.nix b/pkgs/development/python-modules/batchgenerators/default.nix
index 336c6b2e51348..a20d0c696cd6f 100644
--- a/pkgs/development/python-modules/batchgenerators/default.nix
+++ b/pkgs/development/python-modules/batchgenerators/default.nix
@@ -1,12 +1,12 @@
 { lib
 , buildPythonPackage
-, isPy27
+, pythonOlder
 , fetchFromGitHub
 , pytestCheckHook
-, unittest2
 , future
 , numpy
 , pillow
+, fetchpatch
 , scipy
 , scikit-learn
 , scikitimage
@@ -16,27 +16,53 @@
 buildPythonPackage rec {
   pname = "batchgenerators";
   version = "0.21";
+  format = "setuptools";
 
-  disabled = isPy27;
+  disabled = pythonOlder "3.7";
 
   src = fetchFromGitHub {
     owner = "MIC-DKFZ";
     repo = pname;
     rev = "v${version}";
-    sha256 = "16bk4r0q3m2c9fawpmj4l7kz0x3fyv1spb92grf44gmyricq3jdb";
-
+    hash = "sha256-q8mBWcy+PkJcfiKtq8P2bnTw56FE1suVS0zUgUEmc5k=";
   };
 
   propagatedBuildInputs = [
-    future numpy pillow scipy scikit-learn scikitimage threadpoolctl
+    future
+    numpy
+    pillow
+    scipy
+    scikit-learn
+    scikitimage
+    threadpoolctl
+  ];
+
+  checkInputs = [
+    pytestCheckHook
   ];
 
-  checkInputs = [ pytestCheckHook unittest2 ];
+  patches = [
+    # Remove deprecated unittest2, https://github.com/MIC-DKFZ/batchgenerators/pull/78
+    (fetchpatch {
+      name = "remove-unittest2.patch";
+      url = "https://github.com/MIC-DKFZ/batchgenerators/commit/87a9437057df8a7550aa3b3eaf840871cc0d5cef.patch";
+      sha256 = "sha256-vozBK7g2dLxx9din/R2vU28Mm+LoGAO/BmQlt/ShmEo=";
+    })
+  ];
+
+  postPatch = ''
+    substituteInPlace setup.py \
+      --replace '"unittest2",' ""
+  '';
+
+  pythonImportsCheck = [
+    "batchgenerators"
+  ];
 
-  meta = {
+  meta = with lib; {
     description = "2D and 3D image data augmentation for deep learning";
     homepage = "https://github.com/MIC-DKFZ/batchgenerators";
-    license = lib.licenses.asl20;
-    maintainers = with lib.maintainers; [ bcdarwin ];
+    license = licenses.asl20;
+    maintainers = with maintainers; [ bcdarwin ];
   };
 }