summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Graves <ngraves@ngraves.fr>2025-11-23 22:11:14 +0100
committerSharlatan Hellseher <sharlatanus@gmail.com>2025-11-27 19:41:28 +0000
commitffa4ce6b723fa73d4d3fc496da0f9ad36d96c8b9 (patch)
tree35014e824bb9d11c922d7de9dc890a1a33353373
parentb39ced1966026c150f1a3c65c34ff1a76eab7ad5 (diff)
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 <sharlatanus@gmail.com>
-rw-r--r--gnu/packages/libusb.scm46
1 files changed, 17 insertions, 29 deletions
diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index 92b706d0cef..2f0dd347a8a 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}.")