git.iko.soy/typeable/nixpkgs
on master help sign in
pybind11: Unify with pythonPackages.pybind11
084eaa4Josef Kemetmüller
pkgs/development/libraries/pybind11/default.nixdeleted−47
@@ -1,47 +0,0 @@
1−{ stdenv, fetchurl, fetchFromGitHub, cmake, catch, python, eigen }:
2−
3−stdenv.mkDerivation rec {
4− pname = "pybind";
5− version = "2.2.4";
6−
7− src = fetchFromGitHub {
8− owner = "pybind";
9− repo = "pybind11";
10− rev = "v${version}";
11− sha256 = "0pa79ymcasv8br5ifbx7878id5py2jpjac3i20cqxr6gs9l6ivlv";
12− };
13−
14− nativeBuildInputs = [ cmake ];
15− checkInputs = with python.pkgs; [ catch eigen pytest numpy scipy ];
16−
17− # Disable test_cmake_build test, as it fails in sandbox
18− # https://github.com/pybind/pybind11/issues/1355
19− patches = [
20− ./no_test_cmake_build.patch
21− (fetchurl { # Remove on bump to v2.2.5
22− name = "pytest_namespace_to_configure.patch";
23− url = "https://github.com/pybind/pybind11/commit/e7ef34f23f194cfa40bdbf967c6d34712261a4ee.patch";
24− sha256 = "1dhv6p0b5fxzxc8j3sfy8kvfmdshczk22xfxh6bk0cfnfdy9iqrq";
25− })
26− ];
27−
28− doCheck = true;
29−
30− cmakeFlags = [
31− "-DPYTHON_EXECUTABLE=${python.interpreter}"
32− "-DPYBIND11_TEST=${if doCheck then "ON" else "OFF"}"
33− ];
34−
35− meta = {
36− homepage = https://github.com/pybind/pybind11;
37− description = "Seamless operability between C++11 and Python";
38− longDescription = ''
39− Pybind11 is a lightweight header-only library that exposes
40− C++ types in Python and vice versa, mainly to create Python
41− bindings of existing C++ code.
42− '';
43− platforms = with stdenv.lib.platforms; unix;
44− license = stdenv.lib.licenses.bsd3;
45− maintainers = with stdenv.lib.maintainers; [ yuriaisaka ];
46− };
47−}
pkgs/development/libraries/pybind11/no_test_cmake_build.patchdeleted−7
@@ -1,7 +0,0 @@
1−--- a/tests/CMakeLists.txt 2019-01-28 14:13:55.822119328 +0100
2−+++ b/tests/CMakeLists.txt 2019-01-28 14:14:06.741161928 +0100
3−@@ -233,4 +233,3 @@
4− add_subdirectory(test_embed)
5−
6− # Test CMake build using functions and targets from subdirectory or installed location
7−-add_subdirectory(test_cmake_build)
pkgs/development/python-modules/pybind11/default.nix+36−16
@@ -5,9 +5,10 @@
5, python
5, python
6, pytest
6, pytest
7, cmake
7, cmake
8+, catch
8−, numpy ? null
9+, numpy
9−, eigen ? null
10+, eigen
10−, scipy ? null
11+, scipy
11}:
12}:
12
13
13buildPythonPackage rec {
14buildPythonPackage rec {
@@ -21,23 +22,42 @@ buildPythonPackage rec {
21 sha256 = "0k89w4bsfbpzw963ykg1cyszi3h3nk393qd31m6y46pcfxkqh4rd";
22 sha256 = "0k89w4bsfbpzw963ykg1cyszi3h3nk393qd31m6y46pcfxkqh4rd";
22 };
23 };
23
24
24− dontUseCmakeConfigure = true;
25−
26 nativeBuildInputs = [ cmake ];
25 nativeBuildInputs = [ cmake ];
27− checkInputs = [ pytest ]
28− ++ (lib.optional (numpy != null) numpy)
29− ++ (lib.optional (eigen != null) eigen)
30− ++ (lib.optional (scipy != null) scipy);
31− checkPhase = ''
32− cmake ${if eigen != null then "-DEIGEN3_INCLUDE_DIR=${eigen}/include/eigen3" else ""}
33− make -j $NIX_BUILD_CORES pytest
34− '';
35
26
36− # re-expose the headers to other packages
27+ buildInputs = [ catch ];
37− postInstall = ''
28+
29+ cmakeFlags = [
30+ "-DEIGEN3_INCLUDE_DIR=${eigen}/include/eigen3"
31+ ] ++ lib.optionals (!python.isPy2) [
32+ # Enable some tests only on Python 3. The "test_string_view" test
33+ # 'testTypeError: string_view16_chars(): incompatible function arguments'
34+ # fails on Python 2.
35+ "-DPYBIND11_CPP_STANDARD=-std=c++17"
36+ ];
37+
38+ dontUseSetuptoolsBuild = true;
39+ dontUsePipInstall = true;
40+ dontUseSetuptoolsCheck = true;
41+
42+ preFixup = ''
43+ pushd ..
44+ export PYBIND11_USE_CMAKE=1
45+ setuptoolsBuildPhase
46+ pipInstallPhase
47+ # Symlink the CMake-installed headers to the location expected by setuptools
48+ mkdir -p $out/include/${python.libPrefix}
38− ln -s $out/include/python${python.pythonVersion}m/pybind11/ $out/include/pybind11
49+ ln -sf $out/include/pybind11 $out/include/${python.libPrefix}/pybind11
50+ popd
39 '';
51 '';
40
52
53+ installCheckTarget = "pytest";
54+ doInstallCheck = true;
55+ checkInputs = [
56+ pytest
57+ numpy
58+ scipy
59+ ];
60+
41 meta = {
61 meta = {
42 homepage = https://github.com/pybind/pybind11;
62 homepage = https://github.com/pybind/pybind11;
43 description = "Seamless operability between C++11 and Python";
63 description = "Seamless operability between C++11 and Python";
pkgs/top-level/all-packages.nix+1−1
@@ -13531,7 +13531,7 @@ in
13531
13531
13532 pugixml = callPackage ../development/libraries/pugixml { };
13532 pugixml = callPackage ../development/libraries/pugixml { };
13533
13533
13534− pybind11 = callPackage ../development/libraries/pybind11 { };
13534+ pybind11 = pythonPackages.pybind11;
13535
13535
13536 python-qt = callPackage ../development/libraries/python-qt {
13536 python-qt = callPackage ../development/libraries/python-qt {
13537 python = python27;
13537 python = python27;