unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Federico Beffa <beffa@ieee.org>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: [PATCH 1/2] gnu: Add numpy
Date: Sun, 26 Oct 2014 19:56:17 +0100	[thread overview]
Message-ID: <87bnoyk6g9.fsf@gnu.org> (raw)
In-Reply-To: <CAKrPhPOcR-1Ngcq0Wow5_LuSLvntODta2Z5qoTfKF3y6H18UHg@mail.gmail.com> (Federico Beffa's message of "Sun, 26 Oct 2014 14:09:32 +0100")

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

Federico Beffa <beffa@ieee.org> skribis:

> From 063b33562c4fee2ea4e3fd1b53a27770047e9201 Mon Sep 17 00:00:00 2001
> From: Federico Beffa <beffa@fbengineering.ch>
> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 624 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 2872 bytes --]


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	other threads:[~2014-10-26 20:55 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-26 13:09 [PATCH 1/2] gnu: Add numpy Federico Beffa
2014-10-26 18:56 ` Ludovic Courtès [this message]
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-30 13:12         ` Changing python-wrapper to handle lib/ etc Ludovic Courtès
2014-11-02 17:44           ` Andreas Enge
2014-11-02 21:32             ` Andreas Enge
2014-11-03 10:11               ` Federico Beffa
2014-11-03 10:13                 ` Andreas Enge
2014-11-03 20:19                   ` Andreas Enge
2014-11-03 20:49                     ` Andreas Enge
2014-11-03 22:06                       ` Andreas Enge
2014-11-04  9:44                         ` Ludovic Courtès
2014-11-04 13:07                           ` Andreas Enge
2014-11-04 16:48                             ` Ludovic Courtès
2014-11-04 17:08                               ` Andreas Enge
2014-11-04 18:26                                 ` Andreas Enge
2014-11-04 21:40                                 ` Ludovic Courtès
2014-11-04 22:29                                   ` Andreas Enge
2014-11-03  9:04             ` Ludovic Courtès
2014-10-29 22:20     ` [PATCH 1/2] gnu: Add numpy 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
  -- strict thread matches above, loose matches on Subject: below --
2014-10-29 19:17 Federico Beffa
2014-10-29 19:55 ` Federico Beffa
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

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=87bnoyk6g9.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=beffa@ieee.org \
    --cc=guix-devel@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).