~ruther/guix-local

16ca6aaac867862ea6d84c5888bfc59099f335a0 — Marius Bakke 9 years ago c8d7e06
gnu: python-scipy: Use 'modify-phases' syntax.

* gnu/packages/python.scm (python-scipy)[arguments]: Use 'modify-phases'.
1 files changed, 50 insertions(+), 54 deletions(-)

M gnu/packages/python.scm
M gnu/packages/python.scm => gnu/packages/python.scm +50 -54
@@ 3946,13 3946,18 @@ functions.")
    (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-after 'unpack 'fix-tests
           (lambda _
             (substitute* "scipy/integrate/tests/test_quadpack.py"
               (("libm.so") "libm.so.6"))
             #t)
         (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


@@ 3962,53 3967,44 @@ 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
             (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)))))))
                         (assoc-ref inputs "openblas")
                         (assoc-ref inputs "openblas")
                         (assoc-ref inputs "openblas"))))
             #t)
           (delete 'check)
           (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)
                   (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 "." ".*"))))
                 #t)))
           (add-after 'install-doc 'check
             (lambda _
               ;; Tests can only be run after the library has been installed and not
               ;; within the source directory.
               (with-directory-excursion "/tmp"
                 (zero? (system* "python" "-c" "import scipy; scipy.test()"))))))))))
    (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