On Wed, Oct 29, 2014 at 11:11 PM, Ludovic Courtès <l...@gnu.org> wrote:
>> +(define python2-numpy-reference python-numpy-reference)
>> +
>> +(define python2-numpy-userguide python-numpy-userguide)
>
> These variables are unused and not needed, so they can be removed.

Ah, you are right.  I thought that 'package-with-python2' would change
all input prefixes from 'python' to 'python2'.

Please note that this patch will NOT build until the 'python-wrapper'
will be applied (but I tested it again with my previous
'python-wrapper' patch). It is my understanding that Andreas will look
into the 'python-wrapper' patch at a suitable time.

Regards,
Fede
From cab16a360bf478aef6feda8b1977d4318f87eeec Mon Sep 17 00:00:00 2001
From: Federico Beffa <be...@fbengineering.ch>
Date: Thu, 30 Oct 2014 17:10:35 +0100
Subject: [PATCH] gnu: Add numpy.

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

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index c34bdc3..0e2f567 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -1832,3 +1832,91 @@ sources.")
 
 (define-public python2-sphinx
   (package-with-python2 python-sphinx))
+
+(define python-numpy-reference
+  (origin
+    (method url-fetch)
+    (uri (string-append "mirror://sourceforge/numpy/reference.pdf"))
+    (sha256 
+     (base32
+      "0izsmzazhd042ra6p7as2jhwx8713sc5gpn9s5nifwm68biwn0lp"))))
+
+(define python-numpy-userguide
+  (origin
+    (method url-fetch)
+    (uri (string-append "mirror://sourceforge/numpy/userguide.pdf"))
+    (sha256 
+     (base32
+      "1z2xjlxldv01ad2775k9birg1hkqay5wbi5vmgz3rlr6dczvk77k"))))
+
+(define-public python-numpy
+  (package
+    (name "python-numpy")
+    (version "1.9.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://sourceforge/numpy"
+                           "/numpy-" version ".tar.gz"))
+       (sha256
+        (base32
+         "1xbzsb84wg32zx5ilgvkdp0lwfqrycwhh5a2q9nx5iwyjpgcxrpp"))))
+    (build-system python-build-system)
+    (inputs
+     `(("python-numpy-userguide" ,python-numpy-userguide)
+       ("python-numpy-reference" ,python-numpy-reference)
+       ("atlas" ,atlas)))
+    (native-inputs
+     `(("python-nose" ,python-nose)  ; used by tests
+       ("gfortran" ,gfortran-4.8)))
+    (outputs '("out" "doc"))         ; doc is ca. 9MB
+    (arguments
+     `(#:phases
+       (alist-cons-before
+        'build 'set-environment-variables
+        (lambda* (#:key inputs #:allow-other-keys)
+          (let* ((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)))
+        ;; TODO: generate documentation locally, including info files.  The
+        ;; documentation can be built from the source.  However, it needs
+        ;; matplotlib which we currently do not have.
+        (alist-cons-after
+         'install 'install-doc
+         (lambda* (#:key outputs inputs #:allow-other-keys)
+           (let ((doc (string-append (assoc-ref outputs "doc") 
+                                     "/share/doc/" ,name "-" ,version)))
+             (mkdir-p doc)
+             (copy-file (assoc-ref inputs "python-numpy-reference")
+                        (string-append doc "/reference.pdf"))
+             (copy-file (assoc-ref inputs "python-numpy-userguide")
+                        (string-append doc "/userguide.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 numpy; numpy.test()"))))
+          (alist-delete 
+           'check 
+           %standard-phases))))))
+    (home-page "http://www.numpy.org/";)
+    (synopsis "Fundamental package for scientific computing with Python")
+    (description "NumPy is the fundamental package for scientific computing
+with Python. It contains among other things: a powerful N-dimensional array
+object, sophisticated (broadcasting) functions, tools for integrating C/C++
+and Fortran code, useful linear algebra, Fourier transform, and random number
+capabilities.")
+    (license bsd-3)))
+
+(define-public python2-numpy
+  (package-with-python2 python-numpy))
+
-- 
1.8.4

Reply via email to