Subject: [bug#49207] [PATCH 4/6] gnu: Add python-cf-units.

From: Vinicius Monego <[email-masked]>
Date: Fri, 23 Jul 2021 23:25:27 +0000

* gnu/packages/geo.scm (python-cf-units): New variable.
---
 gnu/packages/geo.scm | 47 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
index 37be78edbf..314165062c 100644
--- a/gnu/packages/geo.scm
+++ b/gnu/packages/geo.scm
@@ -58,6 +58,7 @@
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
+  #:use-module (gnu packages c)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages curl)
@@ -898,6 +899,52 @@ Shapely capabilities
 @end itemize")
     (license license:lgpl3+)))
 
+(define-public python-cf-units
+  (package
+    (name "python-cf-units")
+    (version "2.1.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "cf-units" version))
+       (sha256
+        (base32 "0cswphn1cw0qyzglcn4xinr3pfhvbsdyll4hnb702fsfxv9q2cyl"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'disable-doctest
+           (lambda _
+             ;; Two doctests fail.
+             (substitute* "setup.cfg" (("--doctest-modules") ""))))
+         (replace 'check
+           (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+             (when tests?
+               (add-installed-pythonpath inputs outputs)
+               (invoke "pytest" "--pyargs" "cf_units" "-ra"
+                       ;; This test failed.
+                       "-k" "not test_masked_ndarray")))))))
+    (native-inputs
+     `(("python-coveralls" ,python-coveralls)
+       ("python-cython" ,python-cython)
+       ("python-jinja2" ,python-jinja2)
+       ("python-pep8" ,python-pep8)
+       ("python-pytest" ,python-pytest)
+       ("python-pytest-cov" ,python-pytest-cov)
+       ("python-pytest-runner" ,python-pytest-runner)))
+    (inputs
+     `(("udunits" ,udunits)))
+    (propagated-inputs
+     `(("python-antlr4" ,python-antlr4)
+       ("python-cftime" ,python-cftime)
+       ("python-numpy" ,python-numpy)
+       ("python-six" ,python-six)))
+    (home-page "https://github.com/SciTools/cf-units")
+    (synopsis "Units of measure as required by the CF metadata conventions")
+    (description "This package provides units of measure as required by the
+Climate and Forecast (CF) metadata conventions.")
+    (license license:lgpl3)))
+
 (define-public postgis
   (package
     (name "postgis")
-- 
2.30.2