using atlasWithLapack dependency. running test suites for numpy and scipy.

This commit is contained in:
Allen Nelson 2015-05-28 12:30:29 -07:00 committed by Allen Nelson
parent 6eb8ff878d
commit 3d00848ace

View File

@ -7802,6 +7802,49 @@ let
}; };
}; };
# Special check phase for numpy and scipy, following the same set of steps:
# First "install" the package, then import what was installed, and call the
# .test() function, which will run the test suite.
numpyScipyCheckPhase = python: pkgName: ''
runHook preCheck
_python=${python}/bin/${python.executable}
# We will "install" into a temp directory, so that we can run the numpy
# tests (see below).
install_dir="$TMPDIR/test_install"
install_lib="$install_dir/lib/${python.libPrefix}/site-packages"
mkdir -p $install_dir
$_python setup.py install \
--install-lib=$install_lib \
--old-and-unmanageable \
--prefix=$install_dir > /dev/null
# Create a directory in which to run tests (you get an error if you try to
# import the package when you're in the current directory).
mkdir $TMPDIR/run_tests
pushd $TMPDIR/run_tests > /dev/null
# Temporarily add the directory we installed in to the python path
# (not permanently, or this pythonpath will wind up getting exported),
# and run the test suite.
PYTHONPATH="$install_lib:$PYTHONPATH" $_python -c \
'import ${pkgName}; ${pkgName}.test("fast", verbose=10)'
popd > /dev/null
runHook postCheck
'';
# Special prebuild step for numpy and scipy. Creates a site.cfg telling
# the setup script where to find depended-on math libraries.
numpyScipyPrebuild = ''
echo "Creating site.cfg file..."
cat << EOF > site.cfg
[atlas]
include_dirs = ${pkgs.atlasWithLapack}/include
library_dirs = ${pkgs.atlasWithLapack}/lib
EOF
'';
numpy = buildPythonPackage ( rec { numpy = buildPythonPackage ( rec {
name = "numpy-1.9.2"; name = "numpy-1.9.2";
@ -7817,17 +7860,14 @@ let
sed -i '0,/from numpy.distutils.core/s//import setuptools;from numpy.distutils.core/' setup.py sed -i '0,/from numpy.distutils.core/s//import setuptools;from numpy.distutils.core/' setup.py
''; '';
preBuild = '' preBuild = self.numpyScipyPrebuild;
export BLAS=${pkgs.openblas} LAPACK=${pkgs.openblas}
'';
setupPyBuildFlags = ["--fcompiler='gnu95'"]; setupPyBuildFlags = ["--fcompiler='gnu95'"];
# error: invalid command 'test' buildInputs = [ pkgs.gfortran self.nose ];
doCheck = false; propagatedBuildInputs = [ pkgs.atlas ];
buildInputs = with self; [ pkgs.gfortran ]; checkPhase = self.numpyScipyCheckPhase python "numpy";
propagatedBuildInputs = with self; [ pkgs.openblas ];
meta = { meta = {
description = "Scientific tools for Python"; description = "Scientific tools for Python";
@ -11187,19 +11227,19 @@ let
sha256 = "16i5iksaas3m0hgbxrxpgsyri4a9ncbwbiazlhx5d6lynz1wn4m2"; sha256 = "16i5iksaas3m0hgbxrxpgsyri4a9ncbwbiazlhx5d6lynz1wn4m2";
}; };
buildInputs = [ pkgs.gfortran ]; buildInputs = [ pkgs.gfortran self.nose ];
propagatedBuildInputs = with self; [ numpy ]; propagatedBuildInputs = [ self.numpy ];
# TODO: add ATLAS=${pkgs.atlas} # TODO: add ATLAS=${pkgs.atlas}
preConfigure = '' preConfigure = ''
export BLAS=${pkgs.blas} LAPACK=${pkgs.liblapack}
sed -i '0,/from numpy.distutils.core/s//import setuptools;from numpy.distutils.core/' setup.py sed -i '0,/from numpy.distutils.core/s//import setuptools;from numpy.distutils.core/' setup.py
''; '';
preBuild = self.numpyScipyPrebuild;
setupPyBuildFlags = [ "--fcompiler='gnu95'" ]; setupPyBuildFlags = [ "--fcompiler='gnu95'" ];
# error: invalid command 'test' checkPhase = self.numpyScipyCheckPhase python "scipy";
doCheck = false;
meta = { meta = {
description = "SciPy (pronounced 'Sigh Pie') is open-source software for mathematics, science, and engineering. "; description = "SciPy (pronounced 'Sigh Pie') is open-source software for mathematics, science, and engineering. ";