diff options
author | Peter Simons <simons@cryp.to> | 2015-06-04 19:59:46 +0200 |
---|---|---|
committer | Peter Simons <simons@cryp.to> | 2015-06-04 19:59:46 +0200 |
commit | f1587a2d1ecfebdf9a8b20c2408adfec8806f879 (patch) | |
tree | 15168fdacd1e25d56818a3bfee78ca2fe8676252 /pkgs/development/python-modules | |
parent | fcee71066b61fe5384caaa172ebdcf02d0cffedb (diff) | |
download | nixlib-f1587a2d1ecfebdf9a8b20c2408adfec8806f879.tar nixlib-f1587a2d1ecfebdf9a8b20c2408adfec8806f879.tar.gz nixlib-f1587a2d1ecfebdf9a8b20c2408adfec8806f879.tar.bz2 nixlib-f1587a2d1ecfebdf9a8b20c2408adfec8806f879.tar.lz nixlib-f1587a2d1ecfebdf9a8b20c2408adfec8806f879.tar.xz nixlib-f1587a2d1ecfebdf9a8b20c2408adfec8806f879.tar.zst nixlib-f1587a2d1ecfebdf9a8b20c2408adfec8806f879.zip |
Move numpy-scipy-support.nix file from the top-level to development/python-modules.
The top-level is not supposed to contain sub-directories, IMHO.
Diffstat (limited to 'pkgs/development/python-modules')
-rw-r--r-- | pkgs/development/python-modules/numpy-scipy-support.nix | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/numpy-scipy-support.nix b/pkgs/development/python-modules/numpy-scipy-support.nix new file mode 100644 index 000000000000..6cca704dcdae --- /dev/null +++ b/pkgs/development/python-modules/numpy-scipy-support.nix @@ -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 + ''; +} |