summary refs log tree commit diff
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <me@tobias.gr>2023-07-16 02:00:07 +0200
committerTobias Geerinckx-Rice <me@tobias.gr>2023-07-16 02:00:01 +0200
commite0fbbaf84c6fb13738a91b8db497d852121b8465 (patch)
treea9e1d1a2fd3364ed16d6b59884e6f2a4c9f3b203
parent2cce0f10de472ed1ae0f8553a20ddfdfb88242f1 (diff)
downloadguix-e0fbbaf84c6fb13738a91b8db497d852121b8465.tar.gz
gnu: python-pyzstd: Unbundle and dynamically link Zstd.
* gnu/packages/python-compression.scm (python-pyzstd)[source]:
Delete bundled Zstd.
[arguments]: Add "--dynamic-link-zstd" configure flag, and honour it.
[inputs]: Add zstd.
-rw-r--r--gnu/packages/python-compression.scm28
1 files changed, 26 insertions, 2 deletions
diff --git a/gnu/packages/python-compression.scm b/gnu/packages/python-compression.scm
index 6adb1cd757..000d42524d 100644
--- a/gnu/packages/python-compression.scm
+++ b/gnu/packages/python-compression.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2017, 2018, 2023 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2017, 2019, 2021, 2022 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017 Nikita <nikita@n0.is>
 ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
@@ -568,8 +568,32 @@ provided.")
        (method url-fetch)
        (uri (pypi-uri "pyzstd" version))
        (sha256
-        (base32 "1iycfmif15v1jhv0gsza1hyd1hn3sz0vn9s1y79abzv8axndxzfb"))))
+        (base32 "1iycfmif15v1jhv0gsza1hyd1hn3sz0vn9s1y79abzv8axndxzfb"))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           ;; Remove a bundled copy of the zstd sources.
+           (delete-file-recursively "zstd")))))
     (build-system python-build-system)
+    (arguments
+     (list
+      #:configure-flags
+      #~(list "--dynamic-link-zstd")
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'build
+            ;; The python-build-system's phase doesn't honour configure-flags.
+            (lambda* (#:key configure-flags #:allow-other-keys)
+              (apply invoke "python" "./setup.py" "build"
+                     configure-flags)))
+          (replace 'check
+            ;; The python-build-system's phase doesn't honour configure-flags.
+            (lambda* (#:key tests? test-target configure-flags
+                      #:allow-other-keys)
+              (when tests?
+                (apply invoke "python" "./setup.py" test-target
+                       configure-flags)))))))
+    (inputs (list `(,zstd "lib")))
     (home-page "https://github.com/animalize/pyzstd")
     (synopsis "Zstandard bindings for Python")
     (description "This package provides Python bindings to the Zstandard (zstd)