diff --git a/pkgs/development/libraries/pybind11/default.nix b/pkgs/development/libraries/pybind11/default.nix deleted file mode 100644 index 7dfbdc4d64a0..000000000000 --- a/pkgs/development/libraries/pybind11/default.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ stdenv, fetchurl, fetchFromGitHub, cmake, catch, python, eigen }: - -stdenv.mkDerivation rec { - pname = "pybind"; - version = "2.2.4"; - - src = fetchFromGitHub { - owner = "pybind"; - repo = "pybind11"; - rev = "v${version}"; - sha256 = "0pa79ymcasv8br5ifbx7878id5py2jpjac3i20cqxr6gs9l6ivlv"; - }; - - nativeBuildInputs = [ cmake ]; - checkInputs = with python.pkgs; [ catch eigen pytest numpy scipy ]; - - # Disable test_cmake_build test, as it fails in sandbox - # https://github.com/pybind/pybind11/issues/1355 - patches = [ - ./no_test_cmake_build.patch - (fetchurl { # Remove on bump to v2.2.5 - name = "pytest_namespace_to_configure.patch"; - url = "https://github.com/pybind/pybind11/commit/e7ef34f23f194cfa40bdbf967c6d34712261a4ee.patch"; - sha256 = "1dhv6p0b5fxzxc8j3sfy8kvfmdshczk22xfxh6bk0cfnfdy9iqrq"; - }) - ]; - - doCheck = true; - - cmakeFlags = [ - "-DPYTHON_EXECUTABLE=${python.interpreter}" - "-DPYBIND11_TEST=${if doCheck then "ON" else "OFF"}" - ]; - - meta = { - homepage = https://github.com/pybind/pybind11; - description = "Seamless operability between C++11 and Python"; - longDescription = '' - Pybind11 is a lightweight header-only library that exposes - C++ types in Python and vice versa, mainly to create Python - bindings of existing C++ code. - ''; - platforms = with stdenv.lib.platforms; unix; - license = stdenv.lib.licenses.bsd3; - maintainers = with stdenv.lib.maintainers; [ yuriaisaka ]; - }; -} diff --git a/pkgs/development/libraries/pybind11/no_test_cmake_build.patch b/pkgs/development/libraries/pybind11/no_test_cmake_build.patch deleted file mode 100644 index c5d6ecc4481e..000000000000 --- a/pkgs/development/libraries/pybind11/no_test_cmake_build.patch +++ /dev/null @@ -1,7 +0,0 @@ ---- a/tests/CMakeLists.txt 2019-01-28 14:13:55.822119328 +0100 -+++ b/tests/CMakeLists.txt 2019-01-28 14:14:06.741161928 +0100 -@@ -233,4 +233,3 @@ - add_subdirectory(test_embed) - - # Test CMake build using functions and targets from subdirectory or installed location --add_subdirectory(test_cmake_build) diff --git a/pkgs/development/python-modules/pybind11/default.nix b/pkgs/development/python-modules/pybind11/default.nix index 2df360dfaabb..0f386a7c42fe 100644 --- a/pkgs/development/python-modules/pybind11/default.nix +++ b/pkgs/development/python-modules/pybind11/default.nix @@ -5,9 +5,10 @@ , python , pytest , cmake -, numpy ? null -, eigen ? null -, scipy ? null +, catch +, numpy +, eigen +, scipy }: buildPythonPackage rec { @@ -21,22 +22,41 @@ buildPythonPackage rec { sha256 = "0k89w4bsfbpzw963ykg1cyszi3h3nk393qd31m6y46pcfxkqh4rd"; }; - dontUseCmakeConfigure = true; - nativeBuildInputs = [ cmake ]; - checkInputs = [ pytest ] - ++ (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 + + buildInputs = [ catch ]; + + cmakeFlags = [ + "-DEIGEN3_INCLUDE_DIR=${eigen}/include/eigen3" + ] ++ lib.optionals (!python.isPy2) [ + # Enable some tests only on Python 3. The "test_string_view" test + # 'testTypeError: string_view16_chars(): incompatible function arguments' + # fails on Python 2. + "-DPYBIND11_CPP_STANDARD=-std=c++17" + ]; + + dontUseSetuptoolsBuild = true; + dontUsePipInstall = true; + dontUseSetuptoolsCheck = true; + + preFixup = '' + pushd .. + export PYBIND11_USE_CMAKE=1 + setuptoolsBuildPhase + pipInstallPhase + # Symlink the CMake-installed headers to the location expected by setuptools + mkdir -p $out/include/${python.libPrefix} + ln -sf $out/include/pybind11 $out/include/${python.libPrefix}/pybind11 + popd ''; - # re-expose the headers to other packages - postInstall = '' - ln -s $out/include/python${python.pythonVersion}m/pybind11/ $out/include/pybind11 - ''; + installCheckTarget = "pytest"; + doInstallCheck = true; + checkInputs = [ + pytest + numpy + scipy + ]; meta = { homepage = https://github.com/pybind/pybind11; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ec80061329eb..abdb94363cd1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13531,7 +13531,7 @@ in pugixml = callPackage ../development/libraries/pugixml { }; - pybind11 = callPackage ../development/libraries/pybind11 { }; + pybind11 = pythonPackages.pybind11; python-qt = callPackage ../development/libraries/python-qt { python = python27;