Subject: [PATCH 7/7] gnu: python-scipy: Update to 0.18.1.

From: Thomas Danckaert <[email-masked]>
Date: Wed, 22 Feb 2017 12:22:53 +0100

From: Thomas Danckaert <[email-masked]>

* gnu/packages/python.scm (python-scipy): Update to 0.18.1.
[source]: Use github instead of sourceforge.
[native-inputs]: Add python-cython.
---
 gnu/packages/python.scm | 113 +++++++++++++++++++++++-------------------------
 1 file changed, 53 insertions(+), 60 deletions(-)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 9a842cbf7..0b60d4926 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -3900,16 +3900,16 @@ functions.")
 (define-public python-scipy
   (package
     (name "python-scipy")
-    (version "0.16.0")
+    (version "0.18.1")
     (source
      (origin
        (method url-fetch)
-; http://downloads.sourceforge.net/project/scipy/scipy/0.16.1/scipy-0.16.1.tar.gz
-       (uri (string-append "mirror://sourceforge/scipy/scipy/" version
-                           "/scipy-" version ".tar.xz"))
+       (uri (string-append "https://github.com/scipy/scipy/archive/v"
+                           version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
        (sha256
         (base32
-         "0wa0a4skpda3gx7lb12yn19nhbairlyxrvda2lz2bcawk3x5qzz2"))))
+         "17slsrfawjp7if6qrlx03zhgp05350ginxx8ddpw9zqx43x905sn"))))
     (build-system python-build-system)
     (propagated-inputs
      `(("python-numpy" ,python-numpy)
@@ -3919,22 +3919,22 @@ functions.")
      `(("lapack" ,lapack)
        ("openblas" ,openblas)))
     (native-inputs
-     `(("python-nose" ,python-nose)
+     `(("python-cython" ,python-cython)
+       ("python-nose" ,python-nose)
        ("python-sphinx" ,python-sphinx)
        ("python-numpydoc" ,python-numpydoc)
        ("gfortran" ,gfortran)
-       ("texlive" ,texlive)
        ("perl" ,perl)))
     (outputs '("out" "doc"))
     (arguments
      `(#:phases
-       (alist-cons-before
-        'build 'configure-openblas
-        (lambda* (#:key inputs #:allow-other-keys)
-          (call-with-output-file "site.cfg"
-            (lambda (port)
-              (format port
-                      "[blas]
+       (modify-phases %standard-phases
+         (add-before 'build 'configure-openblas
+           (lambda* (#:key inputs #:allow-other-keys)
+             (call-with-output-file "site.cfg"
+               (lambda (port)
+                 (format port
+                         "[blas]
 libraries = openblas
 library_dirs = ~a/lib
 include_dirs = ~a/include
@@ -3944,53 +3944,46 @@ include_dirs = ~a/include
 library_dirs = ~a/lib
 atlas_libs = openblas
 "
-                      (assoc-ref inputs "openblas")
-                      (assoc-ref inputs "openblas")
-                      (assoc-ref inputs "openblas"))))
-          #t)
-        (alist-cons-after
-         'install 'install-doc
-         (lambda* (#:key inputs outputs #:allow-other-keys)
-           (let* ((data (string-append (assoc-ref outputs "doc") "/share"))
-                  (doc (string-append data "/doc/" ,name "-" ,version))
-                  (html (string-append doc "/html"))
-                  (pyver ,(string-append "PYVER=")))
-             ;; Make installed package available for building the
-             ;; documentation
+                         (assoc-ref inputs "openblas")
+                         (assoc-ref inputs "openblas")
+                         (assoc-ref inputs "openblas"))))
+             #t))
+         (add-after 'install 'install-doc
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((data (string-append (assoc-ref outputs "doc") "/share"))
+                    (doc (string-append data "/doc/" ,name "-" ,version))
+                    (html (string-append doc "/html"))
+                    (pyver ,(string-append "PYVER=")))
+               ;; Make installed package available for building the
+               ;; documentation
+               (add-installed-pythonpath inputs outputs)
+               (with-directory-excursion "doc"
+                 ;; Fix generation of images for mathematical expressions.
+                 (substitute* (find-files "source" "conf\\.py")
+                   (("pngmath_use_preview = True")
+                    "pngmath_use_preview = False"))
+                 (mkdir-p html)
+                 (system* "make" "html" pyver)
+                 (with-directory-excursion "build/html"
+                   (for-each (lambda (file)
+                               (let* ((dir (dirname file))
+                                      (tgt-dir (string-append html "/" dir)))
+                                 (install-file file html)))
+                             (find-files "." ".*")))))))
+         (add-after 'unpack 'fix-tests
+           (lambda _
+             (substitute* "scipy/integrate/tests/test_quadpack.py"
+               (("libm.so") "libm.so.6"))
+             #t))
+           ;; Tests can only be run after the library has been installed and not
+           ;; within the source directory.
+         (delete 'check)
+         (add-after 'install 'check
+           (lambda* (#:key inputs outputs #:allow-other-keys)
              (add-installed-pythonpath inputs outputs)
-             (with-directory-excursion "doc"
-               ;; Fix generation of images for mathematical expressions.
-               (substitute* (find-files "source" "conf\\.py")
-                 (("pngmath_use_preview = True")
-                  "pngmath_use_preview = False"))
-               (mkdir-p html)
-               (system* "make" "html" pyver)
-               (system* "make" "latex" "PAPER=a4" pyver)
-               (system* "make" "-C" "build/latex" "all-pdf" "PAPER=a4" pyver)
-               (copy-file "build/latex/scipy-ref.pdf"
-                          (string-append doc "/scipy-ref.pdf"))
-               (with-directory-excursion "build/html"
-                 (for-each (lambda (file)
-                             (let* ((dir (dirname file))
-                                    (tgt-dir (string-append html "/" dir)))
-                               (install-file file html)))
-                           (find-files "." ".*"))))))
-         ;; 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
-           (alist-cons-after
-            'unpack 'fix-tests
-            (lambda _
-              (substitute* "scipy/integrate/tests/test_quadpack.py"
-                (("libm.so") "libm.so.6"))
-              #t)
-            %standard-phases)))))))
+             (with-directory-excursion "/tmp"
+               (zero? (system* "python" "-c"
+                               "import scipy; scipy.test('full', 2)"))))))))
     (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
-- 
2.11.1