summary refs log tree commit diff
path: root/pkgs/development/python-modules/pybind11
diff options
context:
space:
mode:
authorRobert Scott <code@humanleg.org.uk>2019-09-01 01:59:55 +0100
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2019-09-06 21:15:22 +0200
commitd4713b64939b655a25129ed560e832727f3695fd (patch)
tree0a85dbdc6730c6106c55c48a66f0bbf940d38f4b /pkgs/development/python-modules/pybind11
parent718dbcaf13c5812466970b82785132d90465d314 (diff)
downloadnixpkgs-d4713b64939b655a25129ed560e832727f3695fd.tar
nixpkgs-d4713b64939b655a25129ed560e832727f3695fd.tar.gz
nixpkgs-d4713b64939b655a25129ed560e832727f3695fd.tar.bz2
nixpkgs-d4713b64939b655a25129ed560e832727f3695fd.tar.lz
nixpkgs-d4713b64939b655a25129ed560e832727f3695fd.tar.xz
nixpkgs-d4713b64939b655a25129ed560e832727f3695fd.tar.zst
nixpkgs-d4713b64939b655a25129ed560e832727f3695fd.zip
pythonPackages.pybind11: enable tests
Diffstat (limited to 'pkgs/development/python-modules/pybind11')
-rw-r--r--pkgs/development/python-modules/pybind11/default.nix35
1 files changed, 29 insertions, 6 deletions
diff --git a/pkgs/development/python-modules/pybind11/default.nix b/pkgs/development/python-modules/pybind11/default.nix
index 1b89cb5ada7..25ef662edef 100644
--- a/pkgs/development/python-modules/pybind11/default.nix
+++ b/pkgs/development/python-modules/pybind11/default.nix
@@ -1,12 +1,24 @@
-{ lib, buildPythonPackage, fetchPypi, fetchpatch }:
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, fetchpatch
+, python
+, pytest
+, cmake
+, numpy ? null
+, eigen ? null
+, scipy ? null
+}:
 
 buildPythonPackage rec {
   pname = "pybind11";
   version = "2.3.0";
 
-  src = fetchPypi {
-    inherit pname version;
-    sha256 = "0923ngd2cvck3lhl7584y08n36pm6zqihfm1s69sbdc11xg936hr";
+  src = fetchFromGitHub {
+    owner = "pybind";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "11b6dniri8m05spfd2a19irz82shf4sdca73566bniggrf3zclnf";
   };
 
   patches = [
@@ -14,10 +26,21 @@ buildPythonPackage rec {
       url = https://github.com/pybind/pybind11/commit/44a40dd61e5178985cfb1150cf05e6bfcec73042.patch;
       sha256 = "047nzyfsihswdva96hwchnp4gj2mlbiqvmkdnhxrfi9sji8x31ka";
     })
+    (fetchpatch {
+      name = "pytest-4-excinfo-fix.patch";
+      url = https://github.com/pybind/pybind11/commit/9fd4712121fdbb6202a35be4c788525e6c8ab826.patch;
+      sha256 = "07jjv8jlbszvr2grpm5xqxjac7jb0y68lgb1jcbb93k9vyp1hr33";
+    })
   ];
 
-  # Current PyPi version does not include test suite
-  doCheck = false;
+  checkInputs = [ pytest cmake ]
+    ++ (lib.optional (numpy != null) numpy)
+    ++ (lib.optional (eigen != null) eigen)
+    ++ (lib.optional (scipy != null) scipy);
+  checkPhase = ''
+    cmake ${if eigen != null then "-DEIGEN3_INCLUDE_DIR=${eigen}/include/eigen3" else ""}
+    make -j $NIX_BUILD_CORES pytest
+  '';
 
   meta = {
     homepage = https://github.com/pybind/pybind11;