summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2021-11-17 17:52:18 +0000
committerRicardo Wurmus <rekado@elephly.net>2021-11-17 20:45:58 +0000
commit30474f25d0c85c2604003ffa7bcef396f58d97a9 (patch)
treed0b5d839f983e18472829cfa9ad8df43aa051a13 /gnu
parent7850856591e91850237e163ba9d39509ced718ed (diff)
downloadguix-30474f25d0c85c2604003ffa7bcef396f58d97a9.tar.gz
gnu: python-numcodecs: Unbundle c-blosc.
* gnu/packages/python-xyz.scm (python-numcodecs)[source]: Add snippet to
remove bundled c-blosc sources and pre-built Cython files.
[arguments]: Add build phase 'disable-avx2 and 'unbundle; replace 'check phase
to run pytest; disable tests.
[inputs]: Add c-blosc, lz4, zlib, and zstd.
[native-inputs]: Add python-cython.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/python-xyz.scm44
1 files changed, 42 insertions, 2 deletions
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 4623c7b3b2..0639f3680b 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -22098,13 +22098,53 @@ tool).")
        (uri (pypi-uri "numcodecs" version))
        (sha256
         (base32
-         "0kbfr8pl3x9glsypbq8hzim003f16ml1b1cvgrh4w1sdvgal6j7g"))))
+         "0kbfr8pl3x9glsypbq8hzim003f16ml1b1cvgrh4w1sdvgal6j7g"))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           (delete-file-recursively "c-blosc")
+           (for-each delete-file '("numcodecs/blosc.c"
+                                   "numcodecs/compat_ext.c"
+                                   "numcodecs/lz4.c"
+                                   "numcodecs/vlen.c"
+                                   "numcodecs/zstd.c"))))))
     (build-system python-build-system)
+    (arguments
+     `(#:tests? #false ; TODO: unclear why numcodecs.* are not found
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'disable-avx2
+           (lambda _
+             (setenv "DISABLE_NUMCODECS_AVX2" "1")))
+         (add-after 'unpack 'unbundle
+           (lambda _
+             (substitute* "setup.py"
+               (("sources=sources \\+ blosc_sources,")
+                "sources=sources,")
+               (("extra_compile_args=extra_compile_args")
+                "extra_compile_args=list(base_compile_args)")
+               (("'numcodecs.zstd',")
+                "'numcodecs.zstd', libraries=['zstd'], ")
+               (("'numcodecs.lz4',")
+                "'numcodecs.lz4', libraries=['lz4'], ")
+               (("'numcodecs.blosc',")
+                "'numcodecs.blosc', libraries=['blosc'], "))))
+         (replace 'check
+           (lambda* (#:key tests? inputs outputs #:allow-other-keys)
+             (when tests?
+               (add-installed-pythonpath inputs outputs)
+               (invoke "pytest" "-vv")))))))
+    (inputs
+     `(("c-blosc" ,c-blosc)
+       ("lz4" ,lz4)
+       ("zlib" ,zlib)
+       ("zstd" ,zstd "lib")))
     (propagated-inputs
      `(("python-numpy" ,python-numpy)
        ("python-msgpack" ,python-msgpack)))
     (native-inputs
-     `(("python-pytest" ,python-pytest)
+     `(("python-cython" ,python-cython)
+       ("python-pytest" ,python-pytest)
        ("python-setuptools-scm" ,python-setuptools-scm)))
     (home-page "https://github.com/zarr-developers/numcodecs")
     (synopsis "Buffer compression and transformation codecs")