GNU bug report logs - #50887
[PATCH] gnu: Add python-fitsio.

Previous Next

Package: guix-patches;

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

Date: Wed, 29 Sep 2021 08:52:02 UTC

Severity: normal

Tags: patch

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

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 50887 in the body.
You can then email your comments to 50887 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#50887; Package guix-patches. (Wed, 29 Sep 2021 08:52: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, 29 Sep 2021 08:52:02 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] gnu: Add python-fitsio.
Date: Wed, 29 Sep 2021 10:47:39 +0200
* gnu/packages/astronomy.scm (python-fitsio): New variable.
---
 gnu/packages/astronomy.scm | 43 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index a3f7d5cbf4..4fba3aae99 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -96,6 +96,49 @@ in FITS files.")
     (license (license:non-copyleft "file://License.txt"
                           "See License.txt in the distribution."))))
 
+(define-public python-fitsio
+  (package
+    (name "python-fitsio")
+    (version "1.1.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "fitsio" version))
+       (sha256
+        (base32 "1llql2i6xr9lkdl81jx5nvz80kspamvira90546y32ldy551hq1l"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'unbundle-cfitsio
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let* ((cfitsio (assoc-ref inputs "cfitsio"))
+                    (includedir (string-append "\"" cfitsio "/include\""))
+                    (libdir (string-append "\"" cfitsio "/lib\"")))
+               ;; Use Guix' cfitsio instead of the bundled one
+               (substitute* "setup.py"
+                 (("self.use_system_fitsio = False") "pass")
+                 (("self.system_fitsio_includedir = None") "pass")
+                 (("self.system_fitsio_libdir = None") "pass")
+                 (("self.use_system_fitsio") "True")
+                 (("self.system_fitsio_includedir") includedir)
+                 (("self.system_fitsio_libdir") libdir)))
+             ;; The bzip2 test fails because Guix' cfitsio
+             ;; is built without bzip2 support.
+             (substitute* "fitsio/test.py"
+               (("'SKIP_BZIP_TEST' in os.environ") "True"))
+             #t)))))
+    (propagated-inputs
+     `(("python-numpy" ,python-numpy)
+       ("cfitsio" ,cfitsio)))
+    (home-page "https://github.com/esheldon/fitsio")
+    (synopsis
+     "Python library to read from and write to FITS files")
+    (description
+     "A compact Python library for reading from and writing to FITS files,
+based on the CFITSIO library.")
+    (license license:gpl2)))
+
 (define-public qfits
   (package
     (name "qfits")
-- 
2.33.0





Information forwarded to guix-patches <at> gnu.org:
bug#50887; Package guix-patches. (Fri, 01 Oct 2021 14:06:02 GMT) Full text and rfc822 format available.

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

From: Xinglu Chen <public <at> yoctocell.xyz>
To: Konrad Hinsen <konrad.hinsen <at> fastmail.net>, 50887 <at> debbugs.gnu.org
Subject: Re: [bug#50887] [PATCH] gnu: Add python-fitsio.
Date: Fri, 01 Oct 2021 16:05:44 +0200
[Message part 1 (text/plain, inline)]
On Wed, Sep 29 2021, Konrad Hinsen wrote:

> * gnu/packages/astronomy.scm (python-fitsio): New variable.
> ---
>  gnu/packages/astronomy.scm | 43 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
>
> diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
> index a3f7d5cbf4..4fba3aae99 100644
> --- a/gnu/packages/astronomy.scm
> +++ b/gnu/packages/astronomy.scm
> @@ -96,6 +96,49 @@ in FITS files.")
>      (license (license:non-copyleft "file://License.txt"
>                            "See License.txt in the distribution."))))
>  
> +(define-public python-fitsio
> +  (package
> +    (name "python-fitsio")
> +    (version "1.1.5")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (pypi-uri "fitsio" version))
> +       (sha256
> +        (base32 "1llql2i6xr9lkdl81jx5nvz80kspamvira90546y32ldy551hq1l"))))
> +    (build-system python-build-system)
> +    (arguments
> +     `(#:phases
> +       (modify-phases %standard-phases
> +         (add-after 'unpack 'unbundle-cfitsio
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (let* ((cfitsio (assoc-ref inputs "cfitsio"))
> +                    (includedir (string-append "\"" cfitsio "/include\""))
> +                    (libdir (string-append "\"" cfitsio "/lib\"")))
> +               ;; Use Guix' cfitsio instead of the bundled one
> +               (substitute* "setup.py"
> +                 (("self.use_system_fitsio = False") "pass")
> +                 (("self.system_fitsio_includedir = None") "pass")
> +                 (("self.system_fitsio_libdir = None") "pass")
> +                 (("self.use_system_fitsio") "True")
> +                 (("self.system_fitsio_includedir") includedir)
> +                 (("self.system_fitsio_libdir") libdir)))

Maybe the bundled cfitsio should also be deleted in a ‘snippet’ in the ‘origin’?

> +             ;; The bzip2 test fails because Guix' cfitsio
> +             ;; is built without bzip2 support.
> +             (substitute* "fitsio/test.py"
> +               (("'SKIP_BZIP_TEST' in os.environ") "True"))

This part should probably be put in a separate phase, maybe you could
call it ‘skip-bzip-test’.

> +             #t)))))

Phases don’t need to return #t.

> +    (propagated-inputs
> +     `(("python-numpy" ,python-numpy)
> +       ("cfitsio" ,cfitsio)))
> +    (home-page "https://github.com/esheldon/fitsio")
> +    (synopsis
> +     "Python library to read from and write to FITS files")
> +    (description
> +     "A compact Python library for reading from and writing to FITS files,
> +based on the CFITSIO library.")

The sentence is lacking a subject; the meaning of “FITS” should be
written (I had no idea what it meant).  I suggest something like

  This package provides a Python library for reading from and writing to
  @acronym{FITS, Flexible Image Transport System} files using the
  CFITSIO library.  Among other things, it can

  @itemize
  @item read and write image, binary, and ascii table extensions;

  @item read arbitrary subsets of tables in a lazy manner;

  @item query the rows and columns of a table;

  @item read and write header keywords;

  @item read and write Gzip files directory;

  @item read Zip and Bzip2 files.
  @end itemize

> +    (license license:gpl2)))

‘LICENSE.txt’ looks like gpl2+

Could you send an updated patch?
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#50887; Package guix-patches. (Fri, 01 Oct 2021 17:04:02 GMT) Full text and rfc822 format available.

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

From: Konrad Hinsen <konrad.hinsen <at> fastmail.net>
To: Xinglu Chen <public <at> yoctocell.xyz>, 50887 <at> debbugs.gnu.org
Subject: Re: [bug#50887] [PATCH] gnu: Add python-fitsio.
Date: Fri, 01 Oct 2021 19:03:10 +0200
[Message part 1 (text/plain, inline)]
Xinglu Chen <public <at> yoctocell.xyz> writes:

> Could you send an updated patch?

Here it comes. Thanks for the careful code review! I learned a few
things from this: I didn't know about snippets, nor about the subtle
differences between gpl2 and gpl2+.

Thanks,
  Konrad.

[0001-gnu-Add-python-fitsio.patch (text/x-diff, inline)]
From c95c0b18b4c2da6af7432a3dcf11c5f9984772f8 Mon Sep 17 00:00:00 2001
From: Konrad Hinsen <konrad.hinsen <at> fastmail.net>
Date: Wed, 29 Sep 2021 10:47:39 +0200
Subject: [PATCH] gnu: Add python-fitsio.

* gnu/packages/astronomy.scm (python-fitsio): New variable.
---
 gnu/packages/astronomy.scm | 65 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index a3f7d5cbf4..287cf4a94c 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -96,6 +96,71 @@ in FITS files.")
     (license (license:non-copyleft "file://License.txt"
                           "See License.txt in the distribution."))))
 
+(define-public python-fitsio
+  (package
+    (name "python-fitsio")
+    (version "1.1.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "fitsio" version))
+       (sha256
+        (base32 "1llql2i6xr9lkdl81jx5nvz80kspamvira90546y32ldy551hq1l"))
+       (modules '((guix build utils)))
+       (snippet
+        ;; Remove the bundled cfitsio
+        `(begin
+           (delete-file-recursively "cfitsio3490")
+           (substitute* "MANIFEST.in"
+             (("recursive-include cfitsio3490.*$\n") ""))
+           #t))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'unbundle-cfitsio
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let* ((cfitsio (assoc-ref inputs "cfitsio"))
+                    (includedir (string-append "\"" cfitsio "/include\""))
+                    (libdir (string-append "\"" cfitsio "/lib\"")))
+               ;; Use Guix' cfitsio instead of the bundled one
+               (substitute* "setup.py"
+                 (("self.use_system_fitsio = False") "pass")
+                 (("self.system_fitsio_includedir = None") "pass")
+                 (("self.system_fitsio_libdir = None") "pass")
+                 (("self.use_system_fitsio") "True")
+                 (("self.system_fitsio_includedir") includedir)
+                 (("self.system_fitsio_libdir") libdir)))))
+         (add-after 'unpack 'skip-bzip2-test
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; The bzip2 test fails because Guix' cfitsio
+             ;; is built without bzip2 support.
+             (substitute* "fitsio/test.py"
+               (("'SKIP_BZIP_TEST' in os.environ") "True")))))))
+    (propagated-inputs
+     `(("python-numpy" ,python-numpy)
+       ("cfitsio" ,cfitsio)))
+    (home-page "https://github.com/esheldon/fitsio")
+    (synopsis
+     "Python library to read from and write to FITS files")
+    (description
+     "This package provides a Python library for reading from and writing
+to @acronym{FITS, Flexible Image Transport System} files using the
+CFITSIO library.  Among other things, it can
+
+@itemize
+@item read and write image, binary, and ascii table extensions;
+
+@item read arbitrary subsets of tables in a lazy manner;
+
+@item query the rows and columns of a table;
+
+@item read and write header keywords;
+
+@item read and write Gzip files.
+@end itemize")
+    (license license:gpl2+)))
+
 (define-public qfits
   (package
     (name "qfits")
-- 
2.33.0


Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 04 Oct 2021 14:11:01 GMT) Full text and rfc822 format available.

Notification sent to Konrad Hinsen <konrad.hinsen <at> fastmail.net>:
bug acknowledged by developer. (Mon, 04 Oct 2021 14:11:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Konrad Hinsen <konrad.hinsen <at> fastmail.net>
Cc: Xinglu Chen <public <at> yoctocell.xyz>, 50887-done <at> debbugs.gnu.org
Subject: Re: bug#50887: [PATCH] gnu: Add python-fitsio.
Date: Mon, 04 Oct 2021 16:10:05 +0200
Hi Konrad,

Konrad Hinsen <konrad.hinsen <at> fastmail.net> skribis:

>>From c95c0b18b4c2da6af7432a3dcf11c5f9984772f8 Mon Sep 17 00:00:00 2001
> From: Konrad Hinsen <konrad.hinsen <at> fastmail.net>
> Date: Wed, 29 Sep 2021 10:47:39 +0200
> Subject: [PATCH] gnu: Add python-fitsio.
>
> * gnu/packages/astronomy.scm (python-fitsio): New variable.

Applied.  Thank you & thanks Xinglu for reviewing!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 02 Nov 2021 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 175 days ago.

Previous Next


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