GNU bug report logs - #29784
[PATCH 2/2] gnu: Add python-activepapers

Previous Next

Package: guix-patches;

Reported by: Konrad Hinsen <konrad.hinsen <at> fastmail.net>

Date: Wed, 20 Dec 2017 11:42:02 UTC

Severity: normal

Tags: patch

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 29784 in the body.
You can then email your comments to 29784 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#29784; Package guix-patches. (Wed, 20 Dec 2017 11:42:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Konrad Hinsen <konrad.hinsen <at> fastmail.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 20 Dec 2017 11:42:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Konrad Hinsen <konrad.hinsen <at> fastmail.net>
To: <guix-patches <at> gnu.org>
Subject: [PATCH 2/2] gnu: Add python-activepapers
Date: Tue, 19 Dec 2017 12:50:22 +0100
 gnu/packages/python.scm | 68 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 5580b7d50..1a376e04d 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -12000,3 +12000,71 @@ particularly convenient for use in tests.")
 (define-public python2-tempdir
   (package-with-python2 python-tempdir))
 
+(define-public python-activepapers
+  (package
+    (name "python-activepapers")
+    (version "0.2.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "ActivePapers.Py" version))
+       (sha256
+        (base32
+         "02bpx36ixwag1g958plgjwpxaiadsj4669gsnxc8hb5aw2jplnr5"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'delete-python2-code
+           (lambda _
+             (for-each delete-file
+                       '("lib/activepapers/builtins2.py"
+                         "lib/activepapers/standardlib2.py"
+                         "lib/activepapers/utility2.py"))))
+         (replace 'check
+           (lambda _
+             (use-modules (srfi srfi-1)
+                          (ice-9 ftw))
+             ;; Deactivate the test cases that download files
+             (setenv "NO_NETWORK_ACCESS" "1")
+             ;; For some strange reason, some tests fail if nosetests runs all
+             ;; test modules in a single execution. They pass if each test
+             ;; module is run individually.
+             (every zero?
+                    (map (lambda (filename)
+                           (system* "nosetests"
+                                    (string-append "tests/" filename)))
+                         (scandir "tests"
+                                  (lambda (filename)
+                                    (string-suffix? ".py" filename))))))))))
+    (native-inputs
+     `(("python-tempdir" ,python-tempdir)
+       ("python-nose" ,python-nose)))
+    (propagated-inputs
+     `(("python-h5py" ,python-h5py)))
+    (home-page "http://www.activepapers.org/")
+    (synopsis "Executable papers for scientific computing")
+    (description
+     "ActivePapers is a tool for working with executable papers, which
+combine data, code, and documentation in single-file packages,
+suitable for publication as supplementary material or on repositories
+such as figshare or Zenodo.")
+    (properties `((python2-variant . ,(delay python2-activepapers))))
+    (license license:bsd-3)))
+
+(define-public python2-activepapers
+  (let ((base (package-with-python2
+               (strip-python2-variant python-activepapers))))
+    (package
+      (inherit base)
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (delete 'delete-python2-code)
+             (add-after 'unpack 'delete-python3-code
+               (lambda _
+                 (for-each delete-file
+                           '("lib/activepapers/builtins3.py"
+                             "lib/activepapers/standardlib3.py"
+                             "lib/activepapers/utility3.py")))))))))))
-- 
2.15.1





Information forwarded to guix-patches <at> gnu.org:
bug#29784; Package guix-patches. (Thu, 21 Dec 2017 09:58:02 GMT) Full text and rfc822 format available.

Message #8 received at 29784 <at> debbugs.gnu.org (full text, mbox):

From: ludovic.courtes <at> inria.fr (Ludovic Courtès)
To: Konrad Hinsen <konrad.hinsen <at> fastmail.net>
Cc: 29784 <at> debbugs.gnu.org
Subject: Re: [bug#29784] [PATCH 2/2] gnu: Add python-activepapers
Date: Thu, 21 Dec 2017 10:57:09 +0100
[Message part 1 (text/plain, inline)]
Konrad Hinsen <konrad.hinsen <at> fastmail.net> skribis:

>  gnu/packages/python.scm | 68 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 68 insertions(+)
>
> diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
> index 5580b7d50..1a376e04d 100644
> --- a/gnu/packages/python.scm
> +++ b/gnu/packages/python.scm
> @@ -12000,3 +12000,71 @@ particularly convenient for use in tests.")
>  (define-public python2-tempdir
>    (package-with-python2 python-tempdir))
>  
> +(define-public python-activepapers
> +  (package
> +    (name "python-activepapers")

Awesome!  This had been on my to-do list for a while.  :-)

Below are some suggestions: avoid non-top-level ‘use-modules’ form, and
use ‘invoke’ as discussed recently on guix-devel.

I’m getting a hash mismatch on the source:

--8<---------------cut here---------------start------------->8---
Starting download of /gnu/store/gjxgw8jpak8jr34wpaay35a243xck97k-ActivePapers.Py-0.2.2.tar.gz
From https://pypi.io/packages/source/A/ActivePapers.Py/ActivePapers.Py-0.2.2.tar.gz...
following redirection to `https://pypi.org/packages/source/A/ActivePapers.Py/ActivePapers.Py-0.2.2.tar.gz'...
following redirection to `https://files.pythonhosted.org/packages/source/A/ActivePapers.Py/ActivePapers.Py-0.2.2.tar.gz'...
following redirection to `https://pypi.python.org/packages/32/e0/c7147c88d83f7520aded2308b34e5dcd36c91180a8c850119a749259f284/ActivePapers.Py-0.2.2.tar.gz'...
 ...y-0.2.2.tar.gz  32KiB             2.6MiB/s 00:00 [##################] 100.0%
sha256 hash mismatch for output path `/gnu/store/gjxgw8jpak8jr34wpaay35a243xck97k-ActivePapers.Py-0.2.2.tar.gz'
  expected: 02bpx36ixwag1g958plgjwpxaiadsj4669gsnxc8hb5aw2jplnr5
  actual:   12wkhjh90ffipjzv10swndp2xv9hd7xrxvg6v0n4n3i411pj4xb8
--8<---------------cut here---------------end--------------->8---

Could you check if something is amiss?

Apart from that it LGTM, thank you!

Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 5bc9dea27..dad58cb95 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -12014,7 +12014,12 @@ particularly convenient for use in tests.")
          "02bpx36ixwag1g958plgjwpxaiadsj4669gsnxc8hb5aw2jplnr5"))))
     (build-system python-build-system)
     (arguments
-     `(#:phases
+     `(#:modules ((ice-9 ftw)
+                  (srfi srfi-1)
+                  (guix build utils)
+                  (guix build python-build-system))
+
+       #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'delete-python2-code
            (lambda _
@@ -12024,20 +12029,17 @@ particularly convenient for use in tests.")
                          "lib/activepapers/utility2.py"))))
          (replace 'check
            (lambda _
-             (use-modules (srfi srfi-1)
-                          (ice-9 ftw))
              ;; Deactivate the test cases that download files
              (setenv "NO_NETWORK_ACCESS" "1")
              ;; For some strange reason, some tests fail if nosetests runs all
              ;; test modules in a single execution. They pass if each test
              ;; module is run individually.
-             (every zero?
-                    (map (lambda (filename)
-                           (system* "nosetests"
-                                    (string-append "tests/" filename)))
-                         (scandir "tests"
-                                  (lambda (filename)
-                                    (string-suffix? ".py" filename))))))))))
+             (for-each (lambda (filename)
+                         (invoke "nosetests"
+                                 (string-append "tests/" filename)))
+                       (scandir "tests"
+                                (lambda (filename)
+                                  (string-suffix? ".py" filename)))))))))
     (native-inputs
      `(("python-tempdir" ,python-tempdir)
        ("python-nose" ,python-nose)))

Information forwarded to guix-patches <at> gnu.org:
bug#29784; Package guix-patches. (Thu, 21 Dec 2017 11:54:01 GMT) Full text and rfc822 format available.

Message #11 received at 29784 <at> debbugs.gnu.org (full text, mbox):

From: Konrad Hinsen <konrad.hinsen <at> fastmail.net>
To: Ludovic Courtès <ludovic.courtes <at> inria.fr>
Cc: 29784 <at> debbugs.gnu.org
Subject: Re: [bug#29784] [PATCH 2/2] gnu: Add python-activepapers
Date: Thu, 21 Dec 2017 12:52:51 +0100
Hi Ludo,

> Below are some suggestions: avoid non-top-level ‘use-modules’ form, and
> use ‘invoke’ as discussed recently on guix-devel.

Fine with me! I looked for inspiration in other package definitions, but
probably not the best/most recent ones.

> I’m getting a hash mismatch on the source:

>   expected: 02bpx36ixwag1g958plgjwpxaiadsj4669gsnxc8hb5aw2jplnr5
>   actual:   12wkhjh90ffipjzv10swndp2xv9hd7xrxvg6v0n4n3i411pj4xb8
> --8<---------------cut here---------------end--------------->8---
>
> Could you check if something is amiss?

I figured out there the mismatch comes from, but I have no idea how I
could (and still can) build python-activepapers on my machine, using
precisely the definition I submitted.

I had used a local file (URI of type file:///) for testing, and that's
where the SHA256 in the package definition comes from. Then I uploaded
the working version to PyPI, but from a different machine. I rebuilt the
tarball on that machine, from identical source code, but Python's
setuptools does not care about reproducible builds, so the file I
uploaded has a different hash.

Next I changed the URI in the package definition to (pypi-uri), but
didn't think about verifying (and updating) the hash. I did, however,
re-build the package (two rounds), and that worked fine. I just did it
again, it still builds.

This looks like Guix still uses the tarball in the store, in spite of
the fact that I updated the URI in the package definition. In fact,
nothing is built at all, "guix build" merely shows the store path of the
already existing build. Even when I add --round=2, nothing gets rebuilt
at all.

Konrad.






Information forwarded to guix-patches <at> gnu.org:
bug#29784; Package guix-patches. (Thu, 21 Dec 2017 12:10:01 GMT) Full text and rfc822 format available.

Message #14 received at 29784 <at> debbugs.gnu.org (full text, mbox):

From: Konrad Hinsen <konrad.hinsen <at> fastmail.net>
To: Ludovic Courtès <ludovic.courtes <at> inria.fr>
Cc: 29784 <at> debbugs.gnu.org
Subject: Re: [bug#29784] [PATCH 2/2] gnu: Add python-activepapers
Date: Thu, 21 Dec 2017 13:09:02 +0100
Konrad Hinsen <konrad.hinsen <at> fastmail.net> writes:

> This looks like Guix still uses the tarball in the store, in spite of
> the fact that I updated the URI in the package definition. In fact,

One more test: I did a "guix gc" to clean up the store and re-launched
the build. Now I get the hash mismatch that you reported as well.

So this looks as if I can change the source URI without changing the
hash under which the downloaded file is put in the store - is that
right?

Konrad.




Information forwarded to guix-patches <at> gnu.org:
bug#29784; Package guix-patches. (Thu, 21 Dec 2017 15:48:02 GMT) Full text and rfc822 format available.

Message #17 received at 29784 <at> debbugs.gnu.org (full text, mbox):

From: ludovic.courtes <at> inria.fr (Ludovic Courtès)
To: Konrad Hinsen <konrad.hinsen <at> fastmail.net>
Cc: 29784 <at> debbugs.gnu.org
Subject: Re: [bug#29784] [PATCH 2/2] gnu: Add python-activepapers
Date: Thu, 21 Dec 2017 16:47:05 +0100
Konrad Hinsen <konrad.hinsen <at> fastmail.net> skribis:

> Konrad Hinsen <konrad.hinsen <at> fastmail.net> writes:
>
>> This looks like Guix still uses the tarball in the store, in spite of
>> the fact that I updated the URI in the package definition. In fact,
>
> One more test: I did a "guix gc" to clean up the store and re-launched
> the build. Now I get the hash mismatch that you reported as well.

Yes.  Before running the GC, you still had the store item with the given
hash in your store, the guix-daemon didn’t attempt to fetch it.

To avoid this, you can always run:

  guix build -S the-package --check

before submitting, to force a re-fetch.

Can you resend the patch with the known-good hash?  (Or just the hash if
you prefer.)

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#29784; Package guix-patches. (Thu, 21 Dec 2017 17:01:02 GMT) Full text and rfc822 format available.

Message #20 received at 29784 <at> debbugs.gnu.org (full text, mbox):

From: Konrad Hinsen <konrad.hinsen <at> fastmail.net>
To: Ludovic Courtès <ludovic.courtes <at> inria.fr>
Cc: 29784 <at> debbugs.gnu.org
Subject: Re: [bug#29784] [PATCH 2/2] gnu: Add python-activepapers
Date: Thu, 21 Dec 2017 18:00:21 +0100
ludovic.courtes <at> inria.fr (Ludovic Courtès) writes:

> Yes.  Before running the GC, you still had the store item with the given
> hash in your store, the guix-daemon didn’t attempt to fetch it.
>
> To avoid this, you can always run:
>
>   guix build -S the-package --check
>
> before submitting, to force a re-fetch.

OK, good to know!

> Can you resend the patch with the known-good hash?  (Or just the hash if
> you prefer.)

The good hash is

   12wkhjh90ffipjzv10swndp2xv9hd7xrxvg6v0n4n3i411pj4xb8

Konrad.




Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Fri, 22 Dec 2017 08:48:01 GMT) Full text and rfc822 format available.

Notification sent to Konrad Hinsen <konrad.hinsen <at> fastmail.net>:
bug acknowledged by developer. (Fri, 22 Dec 2017 08:48:02 GMT) Full text and rfc822 format available.

Message #25 received at 29784-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Konrad Hinsen <konrad.hinsen <at> fastmail.net>
Cc: 29784-done <at> debbugs.gnu.org
Subject: Re: [bug#29784] [PATCH 2/2] gnu: Add python-activepapers
Date: Fri, 22 Dec 2017 09:47:46 +0100
Konrad Hinsen <konrad.hinsen <at> fastmail.net> skribis:

> ludovic.courtes <at> inria.fr (Ludovic Courtès) writes:
>
>> Yes.  Before running the GC, you still had the store item with the given
>> hash in your store, the guix-daemon didn’t attempt to fetch it.
>>
>> To avoid this, you can always run:
>>
>>   guix build -S the-package --check
>>
>> before submitting, to force a re-fetch.
>
> OK, good to know!
>
>> Can you resend the patch with the known-good hash?  (Or just the hash if
>> you prefer.)
>
> The good hash is
>
>    12wkhjh90ffipjzv10swndp2xv9hd7xrxvg6v0n4n3i411pj4xb8

Perfect.  Applied, thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 19 Jan 2018 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 154 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.