about summary refs log tree commit diff
path: root/pkgs/development/python-modules/mpi4py/default.nix
diff options
context:
space:
mode:
authorAndreas Herrmann <andreash87@gmx.ch>2014-08-31 20:02:25 +0200
committerAndreas Herrmann <andreash87@gmx.ch>2014-09-02 13:56:47 +0200
commit1e786087e4e5bf8d602c87e49edd2fa5d61b8a82 (patch)
treeab57ae33e8695ed1c0d2a377bcbd27213e9ce421 /pkgs/development/python-modules/mpi4py/default.nix
parentc5168debe863a923d85fe156f535ef37b0841833 (diff)
mpi4py: New package, version 1.3.1
Diffstat (limited to 'pkgs/development/python-modules/mpi4py/default.nix')
-rw-r--r--pkgs/development/python-modules/mpi4py/default.nix55
1 files changed, 55 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/mpi4py/default.nix b/pkgs/development/python-modules/mpi4py/default.nix
new file mode 100644
index 0000000000000..6c487dc07ad08
--- /dev/null
+++ b/pkgs/development/python-modules/mpi4py/default.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchurl, python, buildPythonPackage, mpi, openssh }:
+
+buildPythonPackage rec {
+  name = "mpi4py-1.3.1";
+
+  src = fetchurl {
+    url = "https://bitbucket.org/mpi4py/mpi4py/downloads/${name}.tar.gz";
+    sha256 = "e7bd2044aaac5a6ea87a87b2ecc73b310bb6efe5026031e33067ea3c2efc3507";
+  };
+
+  passthru = {
+    inherit mpi;
+  };
+
+  # The tests in the `test_spawn` module fail in the chroot build environment.
+  # However, they do pass in a pure, or non-pure nix-shell. Hence, we
+  # deactivate these particular tests.
+  # Unfortunately, the command-line arguments to `./setup.py test` are not
+  # correctly passed to the test-runner. Hence, these arguments are patched
+  # directly into `setup.py`.
+  patchPhase = ''
+    sed 's/err = main(cmd.args or \[\])/err = main(cmd.args or ["-v", "-e", "test_spawn"])/' -i setup.py
+  '';
+
+  configurePhase = "";
+
+  installPhase = ''
+    mkdir -p "$out/lib/${python.libPrefix}/site-packages"
+    export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
+
+    ${python}/bin/${python.executable} setup.py install \
+      --install-lib=$out/lib/${python.libPrefix}/site-packages \
+      --prefix="$out"
+
+    # --install-lib:
+    # sometimes packages specify where files should be installed outside the usual
+    # python lib prefix, we override that back so all infrastructure (setup hooks)
+    # work as expected
+  '';
+
+  setupPyBuildFlags = ["--mpicc=${mpi}/bin/mpicc"];
+
+  buildInputs = [ mpi ];
+  # Requires openssh for tests. Tests of dependent packages will also fail,
+  # if openssh is not present. E.g. h5py with mpi support.
+  propagatedBuildInputs = [ openssh ];
+
+  meta = {
+    description = "
+      Provides Python bindings for the Message Passing Interface standard.
+    ";
+    homepage = "http://code.google.com/p/mpi4py/";
+    license = stdenv.lib.licenses.bsd3;
+  };
+}