summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Ostrouchov <chris.ostrouchov@gmail.com>2018-12-02 11:21:50 -0500
committerworldofpeace <worldofpeace@users.noreply.github.com>2018-12-18 10:11:49 -0500
commit19d077a157caabb65133e48fbd109e94932ffab3 (patch)
treeaf3a41e252276b27810e1d9680c0be67f76161d5
parent3eb461dedb762289f3d5c9aa029cfc36a4b7f3c2 (diff)
downloadnixpkgs-19d077a157caabb65133e48fbd109e94932ffab3.tar
nixpkgs-19d077a157caabb65133e48fbd109e94932ffab3.tar.gz
nixpkgs-19d077a157caabb65133e48fbd109e94932ffab3.tar.bz2
nixpkgs-19d077a157caabb65133e48fbd109e94932ffab3.tar.lz
nixpkgs-19d077a157caabb65133e48fbd109e94932ffab3.tar.xz
nixpkgs-19d077a157caabb65133e48fbd109e94932ffab3.tar.zst
nixpkgs-19d077a157caabb65133e48fbd109e94932ffab3.zip
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.
-rw-r--r--pkgs/development/python-modules/pygmo/default.nix43
1 files changed, 24 insertions, 19 deletions
diff --git a/pkgs/development/python-modules/pygmo/default.nix b/pkgs/development/python-modules/pygmo/default.nix
index 2500121dc9e..30e4444f552 100644
--- a/pkgs/development/python-modules/pygmo/default.nix
+++ b/pkgs/development/python-modules/pygmo/default.nix
@@ -1,7 +1,6 @@
 { lib
 , fetchFromGitHub
 , buildPythonPackage
-, cmake
 , eigen
 , nlopt
 , ipopt
@@ -11,38 +10,44 @@
 , cloudpickle
 , ipyparallel
 , numba
+, python
 }:
 
-buildPythonPackage rec {
+let
+  propagatedBuildInputs = [ numpy cloudpickle ipyparallel numba ];
+
+  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
+    '';
+  });
+
+in buildPythonPackage rec {
   pname = "pygmo";
-  version = "2.8";
+  version = pagmo2WithPython.version;
 
-  src = fetchFromGitHub {
-     owner = "esa";
-     repo = "pagmo2";
-     rev = "v${version}";
-     sha256 = "1xwxamcn3fkwr62jn6bkanrwy0cvsksf75hfwx4fvl56awnbz41z";
-  };
+  inherit propagatedBuildInputs;
 
-  buildInputs = [ cmake eigen nlopt ipopt boost pagmo2 ];
-  propagatedBuildInputs = [ numpy cloudpickle ipyparallel numba ];
+  src = pagmo2WithPython;
 
   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}
-
-    make install
-    mv $out/lib/python*/site-packages/pygmo wheel
+    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 ];
   };
 }