pythonPackages.pygmo: 2.8 -> 2.9 refactor fix broken package

Introduce a `pagmo2WithPython` which overrides the pagmo2 expression
and enables the pygmo build. Then hand it over to `buildPythonPackage`
by making it the src to produce a usable package.
This commit is contained in:
Chris Ostrouchov 2018-12-02 11:21:50 -05:00 committed by worldofpeace
parent 3eb461dedb
commit 19d077a157

View File

@ -1,7 +1,6 @@
{ lib
, fetchFromGitHub
, buildPythonPackage
, cmake
, eigen
, nlopt
, ipopt
@ -11,38 +10,44 @@
, cloudpickle
, ipyparallel
, numba
, python
}:
buildPythonPackage rec {
pname = "pygmo";
version = "2.8";
src = fetchFromGitHub {
owner = "esa";
repo = "pagmo2";
rev = "v${version}";
sha256 = "1xwxamcn3fkwr62jn6bkanrwy0cvsksf75hfwx4fvl56awnbz41z";
};
buildInputs = [ cmake eigen nlopt ipopt boost pagmo2 ];
let
propagatedBuildInputs = [ numpy cloudpickle ipyparallel numba ];
preBuild = ''
cp -v -r $src/* .
cmake -DCMAKE_INSTALL_PREFIX=$out -DPAGMO_BUILD_TESTS=no -DCMAKE_SYSTEM_NAME=Linux -DPagmo_DIR=${pagmo2} -DPAGMO_BUILD_PYGMO=yes -DPAGMO_BUILD_PAGMO=no -DPAGMO_WITH_EIGEN3=yes -DPAGMO_WITH_NLOPT=yes -DNLOPT_LIBRARY=${nlopt}/lib/libnlopt_cxx.so -DPAGMO_WITH_IPOPT=yes -DIPOPT=${ipopt}
pagmo2WithPython = pagmo2.overrideAttrs (oldAttrs: {
cmakeFlags = oldAttrs.cmakeFlags ++ [
"-DPAGMO_BUILD_PYGMO=yes"
"-DPAGMO_BUILD_PAGMO=no"
"-DPagmo_DIR=${pagmo2}"
];
buildInputs = [ eigen nlopt ipopt boost pagmo2 ] ++ propagatedBuildInputs;
postInstall = ''
mv wheel $out
'';
});
make install
mv $out/lib/python*/site-packages/pygmo wheel
in buildPythonPackage rec {
pname = "pygmo";
version = pagmo2WithPython.version;
inherit propagatedBuildInputs;
src = pagmo2WithPython;
preBuild = ''
mv ${python.sitePackages}/pygmo wheel
cd wheel
'';
# dont do tests
doCheck = false;
meta = {
meta = with lib; {
description = "Parallel optimisation for Python";
homepage = https://esa.github.io/pagmo2/;
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ costrouc ];
license = licenses.gpl3Plus;
maintainers = [ maintainers.costrouc ];
};
}