unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Federico Beffa <beffa@ieee.org>
To: Guix-devel <guix-devel@gnu.org>, "Ludovic Courtès" <ludo@gnu.org>
Subject: Re: [PATCH 1/2] gnu: Add numpy
Date: Wed, 29 Oct 2014 20:55:52 +0100	[thread overview]
Message-ID: <CAKrPhPPEgfGOFW-mOX=YAbxq-AGL4zMp_cqE27ZMi=Dd4ygyTg@mail.gmail.com> (raw)
In-Reply-To: <CAKrPhPPEsgc4yrVaFFHSfDu0CpV1DABkcTTHcP_H9w=d1u4eBQ@mail.gmail.com>

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

Updated patch.

Regards,
Fede

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

From 6673a353080fd4b5136553624a7d777d243fc9a2 Mon Sep 17 00:00:00 2001
From: Federico Beffa <beffa@fbengineering.ch>
Date: Wed, 29 Oct 2014 20:44:33 +0100
Subject: [PATCH] gnu: Add numpy.

* gnu/packages/python.scm (python-numpy, python2-numpy): New variables.
  (python-wrapper): Add symlink to python lib directory.
---
 gnu/packages/python.scm | 101 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 99 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index c34bdc3..c317ed2 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -227,14 +227,18 @@ data types.")
          (begin
            (use-modules (guix build utils))
            (let ((bin (string-append (assoc-ref %outputs "out") "/bin"))
-                 (python (string-append (assoc-ref %build-inputs "python") "/bin/")))
+                 (python (string-append (assoc-ref %build-inputs "python") "/bin/"))
+                 (lib (string-append (assoc-ref %outputs "out") "/lib"))
+                 (python-lib (string-append 
+                              (assoc-ref %build-inputs "python") "/lib/")))
                 (mkdir-p bin)
                 (for-each
                   (lambda (old new)
                     (symlink (string-append python old)
                              (string-append bin "/" new)))
                   `("python3", "pydoc3", "idle3")
-                  `("python",  "pydoc",  "idle"))))))
+                  `("python",  "pydoc",  "idle"))
+                (symlink python-lib lib)))))
     (description (string-append (package-description python)
      "\n\nThis wrapper package provides symbolic links to the python binaries
       without version suffix."))))
@@ -1832,3 +1836,96 @@ 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 outputs inputs 
+                  #:allow-other-keys #:rest args)
+          (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 python2-numpy-reference python-numpy-reference)
+
+(define python2-numpy-userguide python-numpy-userguide)
+
+(define-public python2-numpy
+  (package-with-python2 python-numpy))
+
-- 
1.8.4


  reply	other threads:[~2014-10-29 19:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-29 19:17 [PATCH 1/2] gnu: Add numpy Federico Beffa
2014-10-29 19:55 ` Federico Beffa [this message]
2014-10-29 22:11   ` Ludovic Courtès
2014-10-30 17:03     ` Federico Beffa
2014-11-19  9:04       ` Ludovic Courtès
2014-11-22 15:31         ` Federico Beffa
2014-11-22 17:21           ` Ludovic Courtès
2014-11-24 19:56             ` Federico Beffa
2014-11-24 21:06               ` Ludovic Courtès
2014-11-24 21:24                 ` Federico Beffa
2014-10-29 22:30   ` Andreas Enge
2014-10-29 21:26 ` Ludovic Courtès
  -- strict thread matches above, loose matches on Subject: below --
2014-10-26 13:09 Federico Beffa
2014-10-26 18:56 ` Ludovic Courtès
2014-10-27 20:26   ` Federico Beffa
2014-10-28  9:34     ` Ludovic Courtès
2014-10-28 17:49       ` Federico Beffa
2014-10-29 21:28         ` Ludovic Courtès
2014-10-28 23:34       ` Ludovic Courtès
2014-10-29 22:23       ` Andreas Enge
2014-10-29 22:20     ` Andreas Enge
2014-10-30 16:56       ` Federico Beffa
2014-10-30 17:03         ` Andreas Enge
2014-10-30 17:05           ` Federico Beffa
2014-11-02 18:21   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKrPhPPEgfGOFW-mOX=YAbxq-AGL4zMp_cqE27ZMi=Dd4ygyTg@mail.gmail.com' \
    --to=beffa@ieee.org \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).