guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: gnu: python-numcodecs: Unbundle c-blosc.


From: guix-commits
Subject: 02/02: gnu: python-numcodecs: Unbundle c-blosc.
Date: Wed, 17 Nov 2021 15:48:17 -0500 (EST)

rekado pushed a commit to branch master
in repository guix.

commit 30474f25d0c85c2604003ffa7bcef396f58d97a9
Author: Ricardo Wurmus <rekado@elephly.net>
AuthorDate: Wed Nov 17 17:52:18 2021 +0000

    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.
---
 gnu/packages/python-xyz.scm | 44 ++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 4623c7b..0639f36 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")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]