guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: gnu: Add numpy.


From: Federico Beffa
Subject: 01/01: gnu: Add numpy.
Date: Tue, 02 Dec 2014 10:13:08 +0000

beffa pushed a commit to branch master
in repository guix.

commit 2ee8869a694803e582e203208d04a0725bfc8241
Author: Federico Beffa <address@hidden>
Date:   Mon Dec 1 13:28:24 2014 +0100

    gnu: Add numpy.
    
    * gnu/packages/python.scm (python-numpy, python2-numpy): New variables.
---
 gnu/packages/python.scm |   71 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index dad68fd..88f8927 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -46,6 +46,8 @@
   #:use-module (gnu packages image)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages which)
+  #:use-module (gnu packages perl)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix utils)
@@ -1939,6 +1941,75 @@ capabilities.")
 (define python2-numpy-bootstrap
   (package-with-python2 python-numpy-bootstrap))
 
+(define-public python-numpy
+  (package (inherit python-numpy-bootstrap)
+    (name "python-numpy")
+    (outputs '("out" "doc"))
+    (inputs 
+     `(("which" ,which)
+       ("python-setuptools" ,python-setuptools)
+       ("python-matplotlib" ,python-matplotlib)
+       ("python-sphinx" ,python-sphinx)
+       ("python-pyparsing" ,python-pyparsing)
+       ("python-numpydoc" ,python-numpydoc)
+       ,@(package-inputs python-numpy-bootstrap)))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("texlive" ,texlive)
+       ("texinfo" ,texinfo)
+       ("perl" ,perl)
+       ,@(package-native-inputs python-numpy-bootstrap)))
+    (arguments
+     `(,@(substitute-keyword-arguments 
+             (package-arguments python-numpy-bootstrap)
+           ((#:phases phases)
+            `(alist-cons-after
+              'install 'install-doc
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let* ((data (string-append (assoc-ref outputs "doc") 
"/share"))
+                       (doc (string-append 
+                             data "/doc/" ,name "-" 
+                             ,(package-version python-numpy-bootstrap)))
+                       (info (string-append data "/info"))
+                       (html (string-append doc "/html"))
+                       (pyver ,(string-append "PYVER=")))
+                  (with-directory-excursion "doc"
+                    (mkdir-p html)
+                    (system* "make" "html" pyver)
+                    (system* "make" "latex" "PAPER=a4" pyver)
+                    (system* "make" "-C" "build/latex" 
+                             "all-pdf" "PAPER=a4" pyver)
+                    ;; FIXME: Generation of the info file fails.
+                    ;; (system* "make" "info" pyver)
+                    ;; (mkdir-p info)
+                    ;; (copy-file "build/texinfo/numpy.info"
+                    ;;            (string-append info "/numpy.info"))
+                    (for-each (lambda (file)
+                                (copy-file (string-append "build/latex" file)
+                                           (string-append doc file)))
+                              '("/numpy-ref.pdf" "/numpy-user.pdf"))
+                    (with-directory-excursion "build/html"
+                      (for-each (lambda (file)
+                                  (let* ((dir (dirname file))
+                                         (tgt-dir (string-append html "/" 
dir)))
+                                    (unless (equal? "." dir)
+                                      (mkdir-p tgt-dir))
+                                    (copy-file file (string-append html "/" 
file))))
+                                (find-files "." ".*"))))))
+              ,phases)))))))
+
+(define-public python2-numpy
+  (let ((numpy (package-with-python2 python-numpy)))
+    (package (inherit numpy)
+      ;; Make sure we use exactly PYTHON2-NUMPYDOC, which is customized for
+      ;; Python 2. Since it is also an input to PYTHON2-MATPLOTLIB, we need to
+      ;; import the right version of 'matplotlib' as well.
+      (inputs `(("python2-numpydoc" ,python2-numpydoc)
+                ("python2-matplotlib" ,python2-matplotlib)
+                ,@(alist-delete "python-numpydoc" 
+                                (alist-delete "python-matplotlib"
+                                              (package-inputs numpy))))))))
+
 (define-public python-pyparsing
   (package
     (name "python-pyparsing")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]