From fe060d317ca756c248d7bc718f887dfa3e8cd1ea Mon Sep 17 00:00:00 2001 From: Federico Beffa Date: Sun, 26 Oct 2014 15:06:14 +0100 Subject: [PATCH 2/2] gnu: Add scipy * gnu/packages/python.scm(python-scipy, python2-scipy): New variables. --- gnu/packages/python.scm | 108 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index b39957a..9ac4699 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -1944,3 +1944,111 @@ capabilities.") ("python-numpy-userguide" ,python-numpy-userguide) ("python-numpy-reference" ,python-numpy-reference) ("atlas" ,atlas))))) + +(define python-scipy-reference + (origin + (method url-fetch) + (uri (string-append "mirror://sourceforge/scipy/reference.pdf")) + (sha256 + (base32 + "1z8dybb2x54px3xm5jd1h60ml2mcllk6xkfrnm3sdzsh6w05ni1b")))) + +;; Scipy 0.14.0 with Numpy 0.19.0 fails several tests. This is known and +;; planned to be fixed in 0.14.1. It is claimed that the failures can safely +;; be ignored: +;; http://mail.scipy.org/pipermail/scipy-dev/2014-September/020043.html +;; https://github.com/scipy/scipy/issues/3853 +;; +;; The main test suite procedure prints the summary message: +;; +;; Ran 16412 tests in 245.033s +;; FAILED (KNOWNFAIL=277, SKIP=927, errors=327, failures=42) +;; +;; However, it still does return normally. +(define-public python-scipy + (package + (name "python-scipy") + (version "0.14.0") + (source + (origin + (method url-fetch) + (uri (string-append "mirror://sourceforge/scipy" + "/scipy-" version ".tar.gz")) + (sha256 + (base32 + "053bmz4qmnk4dmxvspfak8r10rpmy6mzwfzgy33z338ppzka6hab")))) + (build-system python-build-system) + (inputs + `(("python" ,python) ; otherwise ld does not find libpython3.3m + ("python-scipy-reference" ,python-scipy-reference) + ("python-numpy" ,python-numpy) + ("atlas" ,atlas))) + (native-inputs + `(("python-nose" ,python-nose) ; used by tests + ("gfortran" ,gfortran-4.8))) + (outputs '("out" "doc")) ; doc is ca. 17MB + (arguments + `(#:phases + (alist-replace + 'build + (lambda* (#:key outputs inputs + #:allow-other-keys #:rest args) + (let* ((build (assoc-ref %standard-phases 'build)) + (atlas-threaded + (string-append (assoc-ref inputs "atlas") + "/lib/libtatlas.so")) + ;; On single core CPUs only the serial library is created. + (atlas-lib + (if (file-exists? atlas-threaded) + atlas-threaded + (string-append (assoc-ref inputs "atlas") + "/lib/libsatlas.so")))) + (setenv "ATLAS" atlas-lib) + (apply build args))) + (alist-cons-after + 'install 'install-doc + (lambda* (#:key outputs inputs #:allow-other-keys) + ;; procedure from gnu-build-system.scm + (define (package-name) + (let* ((out (assoc-ref outputs "out")) + (base (basename out)) + (dash (string-rindex base #\-))) + (string-drop (if dash + (substring base 0 dash) + base) + (+ 1 (string-index base #\-))))) + + (let ((doc (string-append (assoc-ref outputs "doc") + "/share/doc/" (package-name)))) + (mkdir-p doc) + (zero? + (system* "cp" + (assoc-ref inputs "python-scipy-reference") + (string-append doc "/reference.pdf"))))) + ;; Tests can only be run after the library has been installed and not + ;; within the source directory. + (alist-cons-after + 'install 'check + (lambda _ + (with-directory-excursion "/tmp" + (zero? (system* "python" "-c" "import scipy; scipy.test()")))) + (alist-delete + 'check + %standard-phases)))))) + (home-page "http://www.scipy.org/") + (synopsis "The Scipy library provides efficient numerical routines") + (description "The SciPy library is one of the core packages that make up +the SciPy stack. It provides many user-friendly and efficient numerical +routines such as routines for numerical integration and optimization.") + (license bsd-3))) + +(define-public python2-scipy + (package (inherit (package-with-python2 python-scipy)) + ;; If we don't redefine the inputs here, then python (version 3) is + ;; also imported and its libraries come first in PYTHONPATH. This + ;; causes the 'check phase to fail. + (inputs + `(("python-2" ,python-2) ; otherwise ld does not find libpython2.7 + ("python-scipy-reference" ,python-numpy-reference) + ("python2-numpy" ,python2-numpy) + ("atlas" ,atlas))))) -- 1.8.4