From 1e786087e4e5bf8d602c87e49edd2fa5d61b8a82 Mon Sep 17 00:00:00 2001 From: Andreas Herrmann Date: Sun, 31 Aug 2014 20:02:25 +0200 Subject: [PATCH 1/6] mpi4py: New package, version 1.3.1 --- .../python-modules/mpi4py/default.nix | 55 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 6 ++ 2 files changed, 61 insertions(+) create mode 100644 pkgs/development/python-modules/mpi4py/default.nix diff --git a/pkgs/development/python-modules/mpi4py/default.nix b/pkgs/development/python-modules/mpi4py/default.nix new file mode 100644 index 000000000000..6c487dc07ad0 --- /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; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 7b39b083eea6..c786da4e0e06 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -106,6 +106,12 @@ rec { pylabQtSupport = false; }); + mpi4py = callPackage ../development/python-modules/mpi4py { + inherit (pkgs) stdenv fetchurl openssh; + inherit python buildPythonPackage; + mpi = pkgs.openmpi; + }; + nixpart = callPackage ../tools/filesystems/nixpart { }; # This is used for NixOps to make sure we won't break it with the next major From 728793ef0bb7dd3ebf0bb4471492eed6f3a1a8ab Mon Sep 17 00:00:00 2001 From: Andreas Herrmann Date: Sun, 31 Aug 2014 20:02:38 +0200 Subject: [PATCH 2/6] h5py: New package, version 2.3.1 --- .../python-modules/h5py/default.nix | 43 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 13 ++++++ 2 files changed, 56 insertions(+) create mode 100644 pkgs/development/python-modules/h5py/default.nix diff --git a/pkgs/development/python-modules/h5py/default.nix b/pkgs/development/python-modules/h5py/default.nix new file mode 100644 index 000000000000..9ab68ac4cd2b --- /dev/null +++ b/pkgs/development/python-modules/h5py/default.nix @@ -0,0 +1,43 @@ +{ stdenv, fetchurl, python, buildPythonPackage +, numpy, hdf5, cython +, mpiSupport ? false, mpi4py ? null, mpi ? null }: + +assert mpiSupport == hdf5.mpiSupport; +assert mpiSupport -> mpi != null + && mpi4py != null + && mpi == mpi4py.mpi + && mpi == hdf5.mpi + ; + +with stdenv.lib; + +buildPythonPackage rec { + name = "h5py-2.3.1"; + + src = fetchurl { + url = "https://pypi.python.org/packages/source/h/h5py/${name}.tar.gz"; + md5 = "8f32f96d653e904d20f9f910c6d9dd91"; + }; + + setupPyBuildFlags = [ "--hdf5=${hdf5}" ] + ++ optional mpiSupport "--mpi" + ; + setupPyInstallFlags = setupPyBuildFlags; + + preBuild = if mpiSupport then "export CC=${mpi}/bin/mpicc" else ""; + + buildInputs = [ hdf5 cython ] + ++ optional mpiSupport mpi + ; + propagatedBuildInputs = [ numpy ] + ++ optional mpiSupport mpi4py + ; + + meta = { + description = " + The h5py package is a Pythonic interface to the HDF5 binary data format. + "; + homepage = "http://www.h5py.org/"; + license = stdenv.lib.licenses.bsd2; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index c786da4e0e06..48155df78153 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -90,6 +90,19 @@ rec { ''; }; + h5py = callPackage ../development/python-modules/h5py { + inherit (pkgs) stdenv fetchurl; + inherit python buildPythonPackage cython numpy; + hdf5 = pkgs.hdf5.override { mpi = null; }; + }; + + h5py-mpi = h5py.override { + mpiSupport = true; + mpi = pkgs.openmpi; + hdf5 = pkgs.hdf5.override { mpi = pkgs.openmpi; enableShared = true; }; + inherit mpi4py; + }; + ipython = import ../shells/ipython { inherit (pkgs) stdenv fetchurl sip pyqt4; inherit buildPythonPackage pythonPackages; From f50c5602e9c0519c9fe4cd0ea34696028332f99b Mon Sep 17 00:00:00 2001 From: Andreas Herrmann Date: Wed, 3 Sep 2014 21:31:00 +0200 Subject: [PATCH 3/6] mpi4py: Adhere to package description convention --- pkgs/development/python-modules/mpi4py/default.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/mpi4py/default.nix b/pkgs/development/python-modules/mpi4py/default.nix index 6c487dc07ad0..4422c4e9f37a 100644 --- a/pkgs/development/python-modules/mpi4py/default.nix +++ b/pkgs/development/python-modules/mpi4py/default.nix @@ -46,9 +46,8 @@ buildPythonPackage rec { propagatedBuildInputs = [ openssh ]; meta = { - description = " - Provides Python bindings for the Message Passing Interface standard. - "; + description = + "Provides Python bindings for the Message Passing Interface standard"; homepage = "http://code.google.com/p/mpi4py/"; license = stdenv.lib.licenses.bsd3; }; From 9ac9a06f13a1126c16df95f4f727eee5ea51396e Mon Sep 17 00:00:00 2001 From: Andreas Herrmann Date: Wed, 3 Sep 2014 21:31:13 +0200 Subject: [PATCH 4/6] h5py: Adhere to package description convention --- pkgs/development/python-modules/h5py/default.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/h5py/default.nix b/pkgs/development/python-modules/h5py/default.nix index 9ab68ac4cd2b..f4df05fa595c 100644 --- a/pkgs/development/python-modules/h5py/default.nix +++ b/pkgs/development/python-modules/h5py/default.nix @@ -34,9 +34,8 @@ buildPythonPackage rec { ; meta = { - description = " - The h5py package is a Pythonic interface to the HDF5 binary data format. - "; + description = + "Provides a Pythonic interface to the HDF5 binary data format"; homepage = "http://www.h5py.org/"; license = stdenv.lib.licenses.bsd2; }; From 3a38a9b127fd36db20e1a9b1f0eab2a5fd5086d9 Mon Sep 17 00:00:00 2001 From: Andreas Herrmann Date: Thu, 4 Sep 2014 18:47:57 +0200 Subject: [PATCH 5/6] mpi4py: Change description --- pkgs/development/python-modules/mpi4py/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/mpi4py/default.nix b/pkgs/development/python-modules/mpi4py/default.nix index 4422c4e9f37a..ec181652da66 100644 --- a/pkgs/development/python-modules/mpi4py/default.nix +++ b/pkgs/development/python-modules/mpi4py/default.nix @@ -47,7 +47,7 @@ buildPythonPackage rec { meta = { description = - "Provides Python bindings for the Message Passing Interface standard"; + "Python bindings for the Message Passing Interface standard"; homepage = "http://code.google.com/p/mpi4py/"; license = stdenv.lib.licenses.bsd3; }; From 4cae816420c9b9838b52983bb63cd96c1c1ae5e4 Mon Sep 17 00:00:00 2001 From: Andreas Herrmann Date: Thu, 4 Sep 2014 18:48:08 +0200 Subject: [PATCH 6/6] h5py: Change description --- pkgs/development/python-modules/h5py/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/h5py/default.nix b/pkgs/development/python-modules/h5py/default.nix index f4df05fa595c..39a35ad49c6e 100644 --- a/pkgs/development/python-modules/h5py/default.nix +++ b/pkgs/development/python-modules/h5py/default.nix @@ -35,7 +35,7 @@ buildPythonPackage rec { meta = { description = - "Provides a Pythonic interface to the HDF5 binary data format"; + "Pythonic interface to the HDF5 binary data format"; homepage = "http://www.h5py.org/"; license = stdenv.lib.licenses.bsd2; };