guix_mirror_bot pushed a commit to branch master
in repository guix.

commit ffa4ce6b723fa73d4d3fc496da0f9ad36d96c8b9
Author: Nicolas Graves <[email protected]>
AuthorDate: Sun Nov 23 22:11:14 2025 +0100

    gnu: python-hidapi: Switch to pyproject.
    
    * gnu/packages/libusb.scm (python-hidapi):
    [build-system]: Switch to pyproject-build-system.
    [arguments]<#:phases>: Refresh phase 'patch-configuration.
    Remove other phase replacements, use <#:configure-flags> instead.
    <#:test-backend>: Set it.
    [native-inputs]: Add python-setuptools.
    
    Change-Id: I3ae1ed5b819a80abd3ec17a7fbe69d72a6e7a413
    Signed-off-by: Sharlatan Hellseher <[email protected]>
---
 gnu/packages/libusb.scm | 46 +++++++++++++++++-----------------------------
 1 file changed, 17 insertions(+), 29 deletions(-)

diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index 92b706d0ce..2f0dd347a8 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -775,39 +775,27 @@ HID-Class devices.")
        (modules '((guix build utils)))
        (snippet
         ;; Remove bundled libraries.
-        '(begin
-           (delete-file-recursively "hidapi")
-           #t))))
-    (build-system python-build-system)
+        #~(begin
+            (delete-file-recursively "hidapi")))))
+    (build-system pyproject-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'patch-configuration
-           (lambda* (#:key inputs #:allow-other-keys)
-             (substitute* "setup.py"
-               (("'/usr/include/libusb-1.0'")
-                (string-append "'" (assoc-ref inputs "libusb")
-                               "/include/libusb-1.0'"))
-               (("'/usr/include/hidapi'")
-                (string-append "'" (assoc-ref inputs "hidapi")
-                               "/include/hidapi'")))
-             #t))
-         ;; XXX Necessary because python-build-system drops the arguments.
-         (replace 'build
-           (lambda _
-             (invoke "python" "setup.py" "build" "--with-system-hidapi")))
-         (replace 'check
-           (lambda _
-             (invoke "python" "setup.py" "test" "--with-system-hidapi")))
-         (replace 'install
-           (lambda* (#:key outputs #:allow-other-keys)
-             (invoke "python" "setup.py" "install" "--with-system-hidapi"
-                     (string-append "--prefix=" (assoc-ref outputs "out"))
-                     "--single-version-externally-managed" "--root=/"))))))
+     (list
+      #:test-backend #~'unittest
+      #:configure-flags
+      #~'(("--build-option" . "--with-system-hidapi"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-configuration
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "setup.py"
+                (("/usr/include/libusb-1.0")
+                 (search-input-directory inputs "include/libusb-1.0"))
+                (("/usr/include/hidapi")
+                 (search-input-directory inputs "include/hidapi"))))))))
     (inputs
      (list hidapi libusb eudev))
     (native-inputs
-     (list python-cython pkg-config))
+     (list pkg-config python-cython python-setuptools))
     (home-page "https://github.com/trezor/cython-hidapi";)
     (synopsis "Cython interface to hidapi")
     (description "This package provides a Cython interface to @code{hidapi}.")

Reply via email to