guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] gnu: Add numpy


From: Ludovic Courtès
Subject: Re: [PATCH 1/2] gnu: Add numpy
Date: Sun, 26 Oct 2014 19:56:17 +0100
User-agent: Gnus/5.130011 (Ma Gnus v0.11) Emacs/24.3 (gnu/linux)

Federico Beffa <address@hidden> skribis:

> From 063b33562c4fee2ea4e3fd1b53a27770047e9201 Mon Sep 17 00:00:00 2001
> From: Federico Beffa <address@hidden>
> Date: Sun, 26 Oct 2014 15:03:17 +0100
> Subject: [PATCH 1/2] gnu: Add numpy
>
> * gnu/packages/python.scm(python-numpy, python2-numpy): New variables.
                           ^
Missing space.

> +(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"))))

Can these manuals be built from source?

If they can’t, then that’s non-free documentation.

If they can but the process is tedious, then it’s OK to leave it that
way with a TODO, and also a comment stating what its license is.

> +    (inputs
> +     `(("python" ,python) ; otherwise ld does not find libpython3.3m

This is because Python is not added to ‘LIBRARY_PATH’, right?

I think this is fixed by this patch:

--- a/guix/build-system/python.scm
+++ b/guix/build-system/python.scm
@@ -110,10 +110,11 @@ prepended to the name."
                               '())
                         ,@inputs
 
+                        ("python" ,python)
+
                         ;; Keep the standard inputs of 'gnu-build-system'.
                         ,@(standard-packages)))
-         (build-inputs `(("python" ,python)
-                         ,@native-inputs))
+         (build-inputs native-inputs)
          (outputs outputs)
          (build python-build)
          (arguments (strip-keyword-arguments private-keywords arguments)))))
Can you confirm?

> +       ("python-numpy-userguide" ,python-numpy-userguide)
> +       ("python-numpy-reference" ,python-numpy-reference)
> +       ("atlas" ,atlas)))

As discussed in the other thread, this should probably be the generic
(unoptimized) ATLAS here.

> +       (alist-replace
> +        'build
> +        (lambda* (#:key outputs inputs 
> +                  #:allow-other-keys #:rest args)
> +          (let* ((build (assoc-ref %standard-phases 'build))

Use ‘alist-cons-before’ instead of calling the original ‘build’ phase (I
think this was discussed before and there was rough consensus on that.)

> +        (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))))

Just use (string-append ,name "-" ,version) so the ‘package-name’
procedure isn’t needed.

> +             (and (zero? 
> +                   (system* "cp" 
> +                            (assoc-ref inputs "python-numpy-reference") 
> +                            (string-append doc "/reference.pdf")))
> +                  (zero? 
> +                   (system* "cp" 
> +                            (assoc-ref inputs "python-numpy-userguide")
> +                            (string-append doc "/userguide.pdf"))))))

Use the ‘copy-file’ procedure instead of calling ‘cp’.

> +         ;; 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))))))

Just (alist-replace 'check ...) ?

> +(define-public python2-numpy
> +  (package (inherit (package-with-python2 python-numpy))
> +           ;; 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.

Normally this will no longer be needed if the patch above solves the
problem.

Thanks!

Ludo’.

reply via email to

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