summary refs log tree commit diff
path: root/gnu/packages/astronomy.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/astronomy.scm')
-rw-r--r--gnu/packages/astronomy.scm114
1 files changed, 106 insertions, 8 deletions
diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index 49ed12f3d3..1fb755d271 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -6,6 +6,8 @@
 ;;; Copyright © 2020 R Veera Kumar <vkor@vkten.in>
 ;;; Copyright © 2020, 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com>
+;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2021 Greg Hogan <code@greghogan.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -56,6 +58,7 @@
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages video)
   #:use-module (gnu packages xiph)
+  #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
@@ -580,7 +583,7 @@ any arbitrary astrometric projection defined in the WCS standard.")
          ;; maybe required?
          ("mesa" ,mesa)
          ;; optional: fmtlib, Eigen3;
-         ("fmt" ,fmt)
+         ("fmt" ,fmt-7)
          ("eigen" ,eigen)
          ;; glut: for glut interface
          ("freeglut" ,freeglut)))
@@ -612,6 +615,100 @@ accurately in real time at any rate desired.")
      `(#:configure-flags '("-DENABLE_GTK=ON" "-DENABLE_QT=OFF")
        #:tests? #f))))
 
+(define-public python-astropy
+  (package
+    (name "python-astropy")
+    (version "4.3.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "astropy" version))
+       (sha256
+        (base32 "0lfd6n7v7kas4wvacddnwgccax3ks908735dzilg7dsf7ci52f9d"))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           ;; Remove Python bundles.
+           (with-directory-excursion "astropy/extern"
+             (for-each delete-file-recursively '("ply" "configobj")))
+           ;; Remove cextern bundles and leave the wcslib bundle.  Astropy
+           ;; upgrades to different versions of wcslib every few releases
+           ;; and tests break every upgrade.
+           ;; TODO: unbundle wcslib.
+           (with-directory-excursion "cextern"
+             (for-each delete-file-recursively '("cfitsio" "expat")))
+           #t))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'preparations
+           (lambda _
+             ;; Use our own libraries in place of bundles, with the
+             ;; exception of wcslib.
+             (setenv "ASTROPY_USE_SYSTEM_CFITSIO" "1")
+             (setenv "ASTROPY_USE_SYSTEM_EXPAT" "1")
+             ;; Some tests require a writable home.
+             (setenv "HOME" "/tmp")
+             ;; Relax xfail tests.
+             (substitute* "setup.cfg"
+               (("xfail_strict = true") "xfail_strict = false"))
+             ;; Replace all references to external ply.
+             (let ((ply-files '("coordinates/angle_formats.py"
+                                "utils/parsing.py")))
+               (with-directory-excursion "astropy"
+                 (map (lambda (file)
+                        (substitute* file (("astropy.extern.ply")
+                                           "ply")))
+                      ply-files)))
+             ;; Replace reference to external configobj.
+             (with-directory-excursion "astropy/config"
+               (substitute* "configuration.py"
+                 (("from astropy.extern.configobj ") "")))))
+         ;; This file is opened in both install and check phases.
+         (add-before 'install 'writable-compiler
+           (lambda _ (make-file-writable "astropy/_compiler.c")))
+         (add-before 'check 'writable-compiler
+           (lambda _ (make-file-writable "astropy/_compiler.c")))
+         (replace 'check
+           (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+             (when tests?
+               (add-installed-pythonpath inputs outputs)
+               ;; Extensions have to be rebuilt before running the tests.
+               (invoke "python" "setup.py" "build_ext" "--inplace")
+               (invoke "python" "-m" "pytest" "--pyargs" "astropy"
+                       ;; Skip tests that need remote data.
+                       "-m" "not remote_data")))))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("python-coverage" ,python-coverage)
+       ("python-cython" ,python-cython)
+       ("python-extension-helpers" ,python-extension-helpers)
+       ("python-ipython" ,python-ipython)
+       ("python-jplephem" ,python-jplephem)
+       ("python-objgraph" ,python-objgraph)
+       ("python-pytest" ,python-pytest)
+       ("python-pytest-astropy" ,python-pytest-astropy)
+       ("python-pytest-xdist" ,python-pytest-xdist)
+       ("python-setuptools-scm" ,python-setuptools-scm)
+       ("python-sgp4" ,python-sgp4)
+       ("python-skyfield" ,python-skyfield)))
+    (inputs
+     `(("cfitsio" ,cfitsio)
+       ("expat" ,expat)))
+    (propagated-inputs
+     `(("python-configobj" ,python-configobj)
+       ("python-numpy" ,python-numpy)
+       ("python-ply" ,python-ply)
+       ("python-pyerfa" ,python-pyerfa)))
+    (home-page "https://www.astropy.org/")
+    (synopsis "Core package for Astronomy in Python")
+    (description
+     "Astropy is a single core package for Astronomy in Python.  It contains
+much of the core functionality and some common tools needed for performing
+astronomy and astrophysics.")
+    (license license:bsd-3)))
+
 (define-public libnova
   (package
     (name "libnova")
@@ -952,13 +1049,13 @@ more.")
 (define-public python-jplephem
   (package
     (name "python-jplephem")
-    (version "2.15")
+    (version "2.16")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "jplephem" version))
        (sha256
-        (base32 "1ca3dswsslij79qg6dcijjz4l0fj6nzmxld8z93v45ahlkhps0g0"))))
+        (base32 "1xvivnsywjaf5lxn3kyg2jhhq393gcwkjrl634m8dn52ypidrcdb"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
@@ -1006,12 +1103,13 @@ JPL ephemerides use to predict raw (x,y,z) planetary positions.")
              (setenv "PYERFA_USE_SYSTEM_LIBERFA" "1")
              #t)))))
     (native-inputs
-     `(("pytest" ,python-pytest)
-       ("setuptools-scm" ,python-setuptools-scm)
-       ("pytest-doctestplus" ,python-pytest-doctestplus)))
+     `(("pytest-doctestplus" ,python-pytest-doctestplus)
+       ("python-pytest" ,python-pytest)
+       ("python-setuptools-scm" ,python-setuptools-scm)))
     (inputs
-     `(("liberfa" ,erfa)
-       ("numpy" ,python-numpy)))
+     `(("liberfa" ,erfa)))
+    (propagated-inputs
+     `(("python-numpy" ,python-numpy)))
     (home-page "https://github.com/liberfa/pyerfa")
     (synopsis "Python bindings for ERFA")
     (description