diff mbox series

[bug#49207,v2,2/5] gnu: Add python-cf-units.

Message ID 20230609145854.2581045-2-monego@posteo.net
State New
Headers show
Series [bug#49207,v2,1/5] gnu: Add python-imagehash. | expand

Commit Message

Vinicius Monego June 9, 2023, 2:58 p.m. UTC
* gnu/packages/geo.scm (python-cf-units): New variable.
---
 gnu/packages/geo.scm | 46 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
index 25805fe2e5..2c15df18cc 100644
--- a/gnu/packages/geo.scm
+++ b/gnu/packages/geo.scm
@@ -1380,6 +1380,52 @@  (define-public postgis
                ;; doc
                license:cc-by-sa3.0))))
 
+(define-public python-cf-units
+  (package
+    (name "python-cf-units")
+    (version "3.2.0")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "cf-units" version))
+              (sha256
+               (base32
+                "0kq76p13ndm8033m0jfbfryhlk3c0iwy1d92sg1f8zqmwi0g3ac8"))))
+    (build-system pyproject-build-system)
+    (arguments
+     ;; FIXME: 'ImportError: cannot import name '_udunits2' from partially
+     ;; initialized module 'cf_units' (most likely due to a circular import)'.
+     ;; Importing works after the package is built.
+     (list #:tests? #f
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'udunits-path
+                 (lambda _
+                   (setenv "UDUNITS2_XML_PATH"
+                           (string-append
+                            #$(this-package-input "udunits")
+                            "/share/udunits/udunits2.xml"))))
+               ;; cf-units has a hard dependency on antlr4 4.7.2 and
+               ;; doesn't work with newer versions.  Upstream is trying
+               ;; to change it or make antlr4 optional, see
+               ;; https://github.com/SciTools/cf-units/issues/313
+               (delete 'sanity-check))))
+    (propagated-inputs (list java-antlr4-runtime-python
+                             python-cftime
+                             python-jinja2
+                             python-numpy))
+    (inputs (list udunits))
+    (native-inputs (list python-codecov
+                         python-cython
+                         python-jinja2
+                         python-pytest
+                         python-pytest-cov
+                         python-setuptools-scm))
+    (home-page "https://github.com/SciTools/cf-units")
+    (synopsis "Units of measure as required by the CF metadata conventions")
+    (description "This package provids units of measure as required by the
+ Climate and Forecast (CF) metadata conventions.")
+    (license license:lgpl3+)))
+
 (define-public tegola
   (package
     (name "tegola")