unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 2/2] gnu: Add scipy
@ 2014-10-26 13:31 Federico Beffa
  2014-10-26 18:59 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Federico Beffa @ 2014-10-26 13:31 UTC (permalink / raw)
  To: Guix-devel

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

Regards,
Fede

[-- Attachment #2: 0002-gnu-Add-scipy.patch --]
[-- Type: text/x-patch, Size: 5282 bytes --]

From fe060d317ca756c248d7bc718f887dfa3e8cd1ea Mon Sep 17 00:00:00 2001
From: Federico Beffa <beffa@fbengineering.ch>
Date: Sun, 26 Oct 2014 15:06:14 +0100
Subject: [PATCH 2/2] gnu: Add scipy

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

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index b39957a..9ac4699 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -1944,3 +1944,111 @@ capabilities.")
               ("python-numpy-userguide" ,python-numpy-userguide)
               ("python-numpy-reference" ,python-numpy-reference)
               ("atlas" ,atlas)))))
+
+(define python-scipy-reference
+  (origin
+    (method url-fetch)
+    (uri (string-append "mirror://sourceforge/scipy/reference.pdf"))
+    (sha256 
+     (base32
+      "1z8dybb2x54px3xm5jd1h60ml2mcllk6xkfrnm3sdzsh6w05ni1b"))))
+
+;; Scipy 0.14.0 with Numpy 0.19.0 fails several tests.  This is known and
+;; planned to be fixed in 0.14.1.  It is claimed that the failures can safely
+;; be ignored:
+;; http://mail.scipy.org/pipermail/scipy-dev/2014-September/020043.html
+;; https://github.com/scipy/scipy/issues/3853 
+;;
+;; The main test suite procedure prints the summary message:
+;;
+;; Ran 16412 tests in 245.033s
+;; FAILED (KNOWNFAIL=277, SKIP=927, errors=327, failures=42)
+;; 
+;; However, it still does return normally.
+(define-public python-scipy
+  (package
+    (name "python-scipy")
+    (version "0.14.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://sourceforge/scipy"
+                           "/scipy-" version ".tar.gz"))
+       (sha256
+        (base32
+         "053bmz4qmnk4dmxvspfak8r10rpmy6mzwfzgy33z338ppzka6hab"))))
+    (build-system python-build-system)
+    (inputs
+     `(("python" ,python) ; otherwise ld does not find libpython3.3m
+       ("python-scipy-reference" ,python-scipy-reference)
+       ("python-numpy" ,python-numpy)       
+       ("atlas" ,atlas)))
+    (native-inputs
+     `(("python-nose" ,python-nose)      ; used by tests
+       ("gfortran" ,gfortran-4.8)))
+    (outputs '("out" "doc"))             ; doc is ca. 17MB
+    (arguments
+     `(#:phases
+       (alist-replace
+        'build
+        (lambda* (#:key outputs inputs 
+                  #:allow-other-keys #:rest args)
+          (let* ((build (assoc-ref %standard-phases 'build))
+                 (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)
+            (apply build args)))
+        (alist-cons-after
+         'install 'install-doc
+         (lambda* (#:key outputs inputs #:allow-other-keys)
+           ;; procedure from gnu-build-system.scm
+           (define (package-name)
+             (let* ((out  (assoc-ref outputs "out"))
+                    (base (basename out))
+                    (dash (string-rindex base #\-)))
+               (string-drop (if dash
+                                (substring base 0 dash)
+                                base)
+                            (+ 1 (string-index base #\-)))))
+
+           (let ((doc (string-append (assoc-ref outputs "doc") 
+                                     "/share/doc/" (package-name))))
+             (mkdir-p doc)
+             (zero? 
+              (system* "cp" 
+                       (assoc-ref inputs "python-scipy-reference") 
+                       (string-append doc "/reference.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 scipy; scipy.test()"))))
+          (alist-delete 
+           'check 
+           %standard-phases))))))
+    (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
+the SciPy stack.  It provides many user-friendly and efficient numerical
+routines such as routines for numerical integration and optimization.")
+    (license bsd-3)))
+
+(define-public python2-scipy
+  (package (inherit (package-with-python2 python-scipy))
+           ;; If we don't redefine the inputs here, then python (version 3) is
+           ;; also imported and its libraries come first in PYTHONPATH.  This
+           ;; causes the 'check phase to fail.
+           (inputs
+            `(("python-2" ,python-2) ; otherwise ld does not find libpython2.7
+              ("python-scipy-reference" ,python-numpy-reference)
+              ("python2-numpy" ,python2-numpy)
+              ("atlas" ,atlas)))))
-- 
1.8.4


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

* Re: [PATCH 2/2] gnu: Add scipy
  2014-10-26 13:31 [PATCH 2/2] gnu: Add scipy Federico Beffa
@ 2014-10-26 18:59 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2014-10-26 18:59 UTC (permalink / raw)
  To: Federico Beffa; +Cc: Guix-devel

Federico Beffa <beffa@ieee.org> skribis:

> From fe060d317ca756c248d7bc718f887dfa3e8cd1ea Mon Sep 17 00:00:00 2001
> From: Federico Beffa <beffa@fbengineering.ch>
> Date: Sun, 26 Oct 2014 15:06:14 +0100
> Subject: [PATCH 2/2] gnu: Add scipy
>
> * gnu/packages/python.scm(python-scipy, python2-scipy): New variables.

I think most of my comments for NumPy apply.

One last thing, if I may:  ;-)

> +    (synopsis "The Scipy library provides efficient numerical routines")

This must not be a sentence.  What about:

  Efficient numerical routines for Python

?

Thanks,
Ludo’.

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

end of thread, other threads:[~2014-10-26 20:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-26 13:31 [PATCH 2/2] gnu: Add scipy Federico Beffa
2014-10-26 18:59 ` 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).