about summary refs log tree commit diff
path: root/pkgs/development/python-modules/chainer/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/chainer/default.nix')
-rw-r--r--pkgs/development/python-modules/chainer/default.nix62
1 files changed, 32 insertions, 30 deletions
diff --git a/pkgs/development/python-modules/chainer/default.nix b/pkgs/development/python-modules/chainer/default.nix
index 1f5be76e2d21..789b0594c152 100644
--- a/pkgs/development/python-modules/chainer/default.nix
+++ b/pkgs/development/python-modules/chainer/default.nix
@@ -1,23 +1,25 @@
-{ lib
-, buildPythonPackage
-, config
-, cudaSupport ? config.cudaSupport
-, cupy
-, fetchFromGitHub
-, filelock
-, mock
-, numpy
-, protobuf
-, pytestCheckHook
-, pythonOlder
-, six
-, typing-extensions
+{
+  lib,
+  buildPythonPackage,
+  config,
+  cudaSupport ? config.cudaSupport,
+  cupy,
+  fetchFromGitHub,
+  filelock,
+  mock,
+  protobuf,
+  pytestCheckHook,
+  pythonOlder,
+  six,
+  setuptools,
+  numpy,
+  typing-extensions,
 }:
 
 buildPythonPackage rec {
   pname = "chainer";
   version = "7.8.1.post1";
-  format = "setuptools";
+  build-system = [ setuptools ];
 
   disabled = pythonOlder "3.7";
 
@@ -28,24 +30,26 @@ buildPythonPackage rec {
     hash = "sha256-epwnExmyCWmwaOz+mJnAl1peEeHLBdQGC62BlLfSTQQ=";
   };
 
-  propagatedBuildInputs = [
+  postPatch = ''
+    substituteInPlace chainer/_environment_check.py \
+      --replace-fail "import numpy.distutils.system_info" "import numpy" \
+      --replace-fail "numpy.distutils.system_info" "numpy.__config__.get_info"
+  '';
+
+  dependencies = [
     filelock
-    numpy
     protobuf
     six
     typing-extensions
-  ] ++ lib.optionals cudaSupport [
-    cupy
-  ];
+    numpy
+  ] ++ lib.optionals cudaSupport [ cupy ];
 
   nativeCheckInputs = [
     mock
     pytestCheckHook
   ];
 
-  pytestFlagsArray = [
-    "tests/chainer_tests/utils_tests"
-  ];
+  pytestFlagsArray = [ "tests/chainer_tests/utils_tests" ];
 
   preCheck = ''
     # cf. https://github.com/chainer/chainer/issues/8621
@@ -61,14 +65,12 @@ buildPythonPackage rec {
     "ideep"
   ];
 
-  pythonImportsCheck = [
-    "chainer"
-  ];
+  pythonImportsCheck = [ "chainer" ];
 
-  meta = with lib; {
-    description = "A flexible framework of neural networks for deep learning";
+  meta = {
+    description = "Flexible framework of neural networks for deep learning";
     homepage = "https://chainer.org/";
-    license = licenses.mit;
-    maintainers = with maintainers; [ hyphon81 ];
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ hyphon81 ];
   };
 }