mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 18:03:04 +00:00
Merge pull request #8045 from adnelson/numpy_scipy_osx
Test suites and working OSX builds for numpy and scipy
This commit is contained in:
commit
76da869d9a
@ -7800,7 +7800,13 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
numpy = buildPythonPackage ( rec {
|
||||
numpy = let
|
||||
support = import ./python-support/numpy-scipy-support.nix {
|
||||
inherit python;
|
||||
atlas = pkgs.atlasWithLapack;
|
||||
pkgName = "numpy";
|
||||
};
|
||||
in buildPythonPackage ( rec {
|
||||
name = "numpy-1.9.2";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
@ -7815,17 +7821,12 @@ let
|
||||
sed -i '0,/from numpy.distutils.core/s//import setuptools;from numpy.distutils.core/' setup.py
|
||||
'';
|
||||
|
||||
preBuild = ''
|
||||
export BLAS=${pkgs.openblas} LAPACK=${pkgs.openblas}
|
||||
'';
|
||||
inherit (support) preBuild checkPhase;
|
||||
|
||||
setupPyBuildFlags = ["--fcompiler='gnu95'"];
|
||||
|
||||
# error: invalid command 'test'
|
||||
doCheck = false;
|
||||
|
||||
buildInputs = with self; [ pkgs.gfortran ];
|
||||
propagatedBuildInputs = with self; [ pkgs.openblas ];
|
||||
buildInputs = [ pkgs.gfortran self.nose ];
|
||||
propagatedBuildInputs = [ pkgs.atlas ];
|
||||
|
||||
meta = {
|
||||
description = "Scientific tools for Python";
|
||||
@ -11203,7 +11204,13 @@ let
|
||||
};
|
||||
|
||||
|
||||
scipy = buildPythonPackage rec {
|
||||
scipy = let
|
||||
support = import ./python-support/numpy-scipy-support.nix {
|
||||
inherit python;
|
||||
atlas = pkgs.atlasWithLapack;
|
||||
pkgName = "numpy";
|
||||
};
|
||||
in buildPythonPackage rec {
|
||||
name = "scipy-0.15.1";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
@ -11211,19 +11218,16 @@ let
|
||||
sha256 = "16i5iksaas3m0hgbxrxpgsyri4a9ncbwbiazlhx5d6lynz1wn4m2";
|
||||
};
|
||||
|
||||
buildInputs = [ pkgs.gfortran ];
|
||||
propagatedBuildInputs = with self; [ numpy ];
|
||||
buildInputs = [ pkgs.gfortran self.nose ];
|
||||
propagatedBuildInputs = [ self.numpy ];
|
||||
|
||||
# TODO: add ATLAS=${pkgs.atlas}
|
||||
preConfigure = ''
|
||||
export BLAS=${pkgs.blas} LAPACK=${pkgs.liblapack}
|
||||
sed -i '0,/from numpy.distutils.core/s//import setuptools;from numpy.distutils.core/' setup.py
|
||||
'';
|
||||
|
||||
setupPyBuildFlags = [ "--fcompiler='gnu95'" ];
|
||||
inherit (support) preBuild checkPhase;
|
||||
|
||||
# error: invalid command 'test'
|
||||
doCheck = false;
|
||||
setupPyBuildFlags = [ "--fcompiler='gnu95'" ];
|
||||
|
||||
meta = {
|
||||
description = "SciPy (pronounced 'Sigh Pie') is open-source software for mathematics, science, and engineering. ";
|
||||
|
53
pkgs/top-level/python-support/numpy-scipy-support.nix
Normal file
53
pkgs/top-level/python-support/numpy-scipy-support.nix
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
# Python package expression
|
||||
python,
|
||||
# Name of package (e.g. numpy or scipy)
|
||||
pkgName,
|
||||
# Atlas math library
|
||||
atlas
|
||||
}:
|
||||
|
||||
{
|
||||
|
||||
# First "install" the package, then import what was installed, and call the
|
||||
# .test() function, which will run the test suite.
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
|
||||
_python=${python}/bin/${python.executable}
|
||||
|
||||
# We will "install" into a temp directory, so that we can run the
|
||||
# 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
|
||||
'';
|
||||
|
||||
# Creates a site.cfg telling the setup script where to find depended-on
|
||||
# math libraries.
|
||||
preBuild = ''
|
||||
echo "Creating site.cfg file..."
|
||||
cat << EOF > site.cfg
|
||||
[atlas]
|
||||
include_dirs = ${atlas}/include
|
||||
library_dirs = ${atlas}/lib
|
||||
EOF
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue
Block a user