pythonPackages.pybind11: improve expression

We shouldn't build and install the package in preFixup.
This commit is contained in:
Robert Schütz 2021-06-20 14:04:46 +02:00 committed by Martin Weinelt
parent 328efcc3e6
commit fbbe75d6e9
2 changed files with 24 additions and 21 deletions

View file

@ -3,12 +3,12 @@
, buildPythonPackage
, fetchFromGitHub
, fetchpatch
, python
, pytest
, cmake
, eigen
, python
, catch
, numpy
, eigen
, pytest
, scipy
}:
@ -33,38 +33,41 @@ buildPythonPackage rec {
nativeBuildInputs = [ cmake ];
buildInputs = [ catch ];
dontUseCmakeBuildDir = true;
cmakeFlags = [
"-DEIGEN3_INCLUDE_DIR=${eigen}/include/eigen3"
"-DBUILD_TESTING=on"
] ++ lib.optionals (python.isPy3k && !stdenv.cc.isClang) [
# 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"
"-DPYBIND11_CXX_STANDARD=-std=c++17"
];
dontUseSetuptoolsBuild = true;
dontUsePipInstall = true;
dontUseSetuptoolsCheck = true;
postBuild = ''
# build tests
make
'';
preFixup = ''
pushd ..
export PYBIND11_USE_CMAKE=1
setuptoolsBuildPhase
pipInstallPhase
postInstall = ''
# 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
'';
checkInputs = [
pytest
catch
numpy
pytest
scipy
];
checkPhase = ''
runHook preCheck
make check
runHook postCheck
'';
meta = with lib; {
homepage = "https://github.com/pybind/pybind11";
description = "Seamless operability between C++11 and Python";
@ -74,6 +77,6 @@ buildPythonPackage rec {
bindings of existing C++ code.
'';
license = licenses.bsd3;
maintainers = with maintainers;[ yuriaisaka ];
maintainers = with maintainers; [ yuriaisaka dotlambda ];
};
}

View file

@ -1,9 +1,9 @@
{lib, fetchPypi, python, buildPythonPackage, gfortran, nose, pytest, numpy, pybind11}:
let
pybind = pybind11.overridePythonAttrs(oldAttrs: {
pybind = pybind11.overridePythonAttrs (oldAttrs: {
cmakeFlags = oldAttrs.cmakeFlags ++ [
"-DPYBIND11_TEST=off"
"-DBUILD_TESTING=off"
];
doCheck = false; # Circular test dependency
});