unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: Add numpy.
@ 2014-12-01 17:17 Federico Beffa
  2014-12-01 20:34 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Federico Beffa @ 2014-12-01 17:17 UTC (permalink / raw)
  To: Guix-devel

[-- Attachment #1: Type: text/plain, Size: 59 bytes --]

Here the user installable version of numpy.

Regards,
Fede

[-- Attachment #2: 0001-gnu-Add-numpy.patch --]
[-- Type: text/x-patch, Size: 4412 bytes --]

From cdf0c1a3193d1855d8b1a512042f91a56c82ea28 Mon Sep 17 00:00:00 2001
From: Federico Beffa <beffa@fbengineering.ch>
Date: Mon, 1 Dec 2014 13:28:24 +0100
Subject: [PATCH] gnu: Add numpy.

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

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index dad68fd..0689ea5 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)
+                    ;; Generation of the info file fails.
+                    ;; (system* "make" "info" pyver)
+                    ;; (mkdir-p info)
+                    ;; (copy-file "build/texinfo/numpy.info"
+                    ;;            (string-append info "/numpy.info"))
+                    (map (lambda (file)
+                           (copy-file (string-append "build/latex" file)
+                                      (string-append doc file)))
+                           '("/numpy-ref.pdf" "/numpy-user.pdf"))
+                    (with-directory-excursion "build/html"
+                      (map (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")
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gnu: Add numpy.
  2014-12-01 17:17 [PATCH] gnu: Add numpy Federico Beffa
@ 2014-12-01 20:34 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2014-12-01 20:34 UTC (permalink / raw)
  To: Federico Beffa; +Cc: Guix-devel

Federico Beffa <beffa@ieee.org> skribis:

> From cdf0c1a3193d1855d8b1a512042f91a56c82ea28 Mon Sep 17 00:00:00 2001
> From: Federico Beffa <beffa@fbengineering.ch>
> Date: Mon, 1 Dec 2014 13:28:24 +0100
> Subject: [PATCH] gnu: Add numpy.
>
> * gnu/packages/python.scm (python-numpy, python2-numpy): New variables.

[...]

> +                    ;; Generation of the info file fails.

Please add FIXME or XXX.  ↑

> +                    (map (lambda (file)
> +                           (copy-file (string-append "build/latex" file)
> +                                      (string-append doc file)))
> +                           '("/numpy-ref.pdf" "/numpy-user.pdf"))

Please use ‘for-each’ instead of ‘map’ (because it’s a for-effect
iteration), and align the file list with “(lambda”.

> +                      (map (lambda (file)

‘for-each’ as well.

OK to push with these changes.

Thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-01 20:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-01 17:17 [PATCH] gnu: Add numpy Federico Beffa
2014-12-01 20:34 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).