1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

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>
This commit is contained in:
Nicolas Graves
2025-11-23 22:11:14 +01:00
committed by Sharlatan Hellseher
parent b39ced1966
commit ffa4ce6b72

View File

@@ -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}.")