Subject: [bug#77975] [PATCH 30/32] gnu: Add python-libstempo.

From: Sharlatan Hellseher <[email-masked]>
Date: Mon, 21 Apr 2025 23:03:29 +0100

* gnu/packages/astronomy.scm (python-libstempo): New variable.

Change-Id: Ia293690cd0778625b9a3441298710a934d51d1c4
---
 gnu/packages/astronomy.scm | 43 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index af0aec7aa6..a983dae05d 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -3601,6 +3601,49 @@ (define-public python-holodeck
 observationally-derived galaxy merger catalogs.")
     (license license:expat)))
 
+(define-public python-libstempo
+  (package
+    (name "python-libstempo")
+    (version "2.5.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "libstempo" version))
+       (sha256
+        (base32 "0408g761w9i0kg69b72y4lnpz5sa8bzd0zayi73q6wkry8lh7ymq"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'build 'set-tempo2-search-paths
+            (lambda _
+              (let* ((tempo2 #$(this-package-input "tempo2"))
+                     (tempo2-runtime (string-append tempo2 "/share/runtime")))
+                (setenv "TEMPO2_PREFIX" tempo2)
+                (setenv "TEMPO2" tempo2-runtime)))))))
+    (native-inputs
+     (list python-cython-3
+           python-numpy
+           python-pytest
+           python-setuptools
+           python-setuptools-scm
+           python-wheel))
+    (inputs
+     (list tempo2))
+    (propagated-inputs
+     (list python-astropy
+           python-ephem
+           python-matplotlib
+           python-numpy
+           python-scipy))
+    (home-page "https://github.com/vallis/libstempo")
+    (synopsis "Python wrapper for tempo2")
+    (description
+     "This package provides a Python wrapper for tempo2 - a high precision
+pulsar timing tool.")
+    (license license:expat)))
+
 (define-public python-lofar-h5plot
   (package
     (name "python-lofar-h5plot")
-- 
2.49.0