summaryrefslogtreecommitdiff
path: root/gnu/packages
diff options
context:
space:
mode:
authorNicolas Graves <ngraves@ngraves.fr>2025-11-23 22:00:50 +0100
committerSharlatan Hellseher <sharlatanus@gmail.com>2025-11-27 19:41:28 +0000
commitb39ced1966026c150f1a3c65c34ff1a76eab7ad5 (patch)
treeaf279cfee694d47e7f14da89622f19e9358f091a /gnu/packages
parent4af4a7f9af8bbdcd327d012e9beb2ea98a8ed3be (diff)
gnu: python-pyusb: Switch to pyproject.
* gnu/packages/libusb.scm (python-pyusb): [build-system]: Switch to pyproject-build-system. [arguments]: Run guix style. <#:modules>: Use (guix build pyproject-build-system). [native-inputs]: Add python-setuptools. Change-Id: I5269de23e9879f3b1e69205e5dd3dd60266690e8 Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/libusb.scm102
1 files changed, 49 insertions, 53 deletions
diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index 0132c255393..92b706d0cef 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -322,60 +322,56 @@ accessing libusb-1.0.")
322 (method url-fetch) 322 (method url-fetch)
323 (uri (pypi-uri "pyusb" version)) 323 (uri (pypi-uri "pyusb" version))
324 (sha256 324 (sha256
325 (base32 325 (base32 "1fg7knfzybzija2b01pzrzhzsj989scl12sb2ra4f503l8279k54"))))
326 "1fg7knfzybzija2b01pzrzhzsj989scl12sb2ra4f503l8279k54")))) 326 (build-system pyproject-build-system)
327 (build-system python-build-system)
328 (arguments 327 (arguments
329 (list #:modules '((srfi srfi-1) 328 (list
330 (srfi srfi-26) 329 #:modules '((srfi srfi-1)
331 (guix build utils) 330 (srfi srfi-26)
332 (guix build python-build-system)) 331 (guix build utils)
333 #:phases 332 (guix build pyproject-build-system))
334 #~(modify-phases %standard-phases 333 #:phases
335 ;; Repurpose the candidates parameter to be the path to the 334 #~(modify-phases %standard-phases
336 ;; library, then on each backend we substitute the candidates 335 ;; Repurpose the candidates parameter to be the path to the library,
337 ;; with the full path to the .so library or with None if not 336 ;; then on each backend we substitute the candidates with the full
338 ;; supported. 337 ;; path to the .so library or with None if not supported.
339 ;; 338 ;;
340 ;; While most applications could use a single back-end this 339 ;; While most applications could use a single back-end this library
341 ;; library allows to manually select the back-end so it is 340 ;; allows to manually select the back-end so it is appropriate to
342 ;; appropriate to provide as much back-ends as possible. 341 ;; provide as much back-ends as possible.
343 (add-after 'unpack 'fix-libusb-reference 342 (add-after 'unpack 'fix-libusb-reference
344 (lambda* (#:key inputs #:allow-other-keys) 343 (lambda* (#:key inputs #:allow-other-keys)
345 (let ((libusb0 (find 344 (let ((libusb0 (find (negate symbolic-link?)
346 (negate symbolic-link?) 345 (find-files (assoc-ref inputs
347 (find-files (assoc-ref inputs "libusb-compat") 346 "libusb-compat")
348 "^libusb-.*\\.so\\..*"))) 347 "^libusb-.*\\.so\\..*")))
349 (libusb1 (find 348 (libusb1 (find (negate symbolic-link?)
350 (negate symbolic-link?) 349 (find-files (assoc-ref inputs "libusb")
351 (find-files (assoc-ref inputs "libusb") 350 "^libusb-.*\\.so\\..*"))))
352 "^libusb-.*\\.so\\..*")))) 351 (substitute* "usb/libloader.py"
353 (substitute* "usb/libloader.py" 352 (("lib = locate_library\\(candidates, find_library\\)")
354 (("lib = locate_library\\(candidates, find_library\\)") 353 "lib = candidates"))
355 "lib = candidates")) 354 (substitute* "usb/backend/libusb0.py"
356 (substitute* "usb/backend/libusb0.py" 355 (("\\('usb-0\\.1', 'usb', 'libusb0'\\)")
357 (("\\('usb-0\\.1', 'usb', 'libusb0'\\)") 356 (format #f "~s" libusb0)))
358 (format #f "~s" libusb0))) 357 (substitute* "usb/backend/libusb1.py"
359 (substitute* "usb/backend/libusb1.py" 358 (("\\('usb-1\\.0', 'libusb-1\\.0', 'usb'\\)")
360 (("\\('usb-1\\.0', 'libusb-1\\.0', 'usb'\\)") 359 (format #f "~s" libusb1)))
361 (format #f "~s" libusb1))) 360 ;; FIXME: OpenUSB is not packaged for GNU Guix.
362 ;; FIXME: OpenUSB is not packaged for GNU Guix. 361 (substitute* "usb/backend/openusb.py"
363 (substitute* "usb/backend/openusb.py" 362 (("\\('openusb',\\)")
364 (("\\('openusb',\\)") "None"))))) 363 "None")))))
365 ;; Note: tests seems to succeed with libusb-compat as libusb 364 ;; Note: tests seems to succeed with libusb-compat as libusb fails
366 ;; fails because it doesn't have a usbfs present in the build 365 ;; because it doesn't have a usbfs present in the build environment.
367 ;; environment. 366 (replace 'check
368 (replace 'check 367 (lambda* (#:key tests? #:allow-other-keys)
369 (lambda* (#:key tests? #:allow-other-keys) 368 (when tests?
370 (when tests? 369 (with-directory-excursion "tests"
371 (with-directory-excursion "tests" 370 (setenv "PYUSB_DEBUG" "debug")
372 (setenv "PYUSB_DEBUG" "debug") 371 (setenv "LIBUSB_DEBUG" "4")
373 (setenv "LIBUSB_DEBUG" "4") 372 (invoke "python" "testall.py"))))))))
374 (invoke "python" "testall.py")))))))) 373 (native-inputs (list python-setuptools-scm python-setuptools))
375 (native-inputs 374 (inputs (list libusb libusb-compat))
376 (list python-setuptools-scm))
377 (inputs
378 (list libusb libusb-compat))
379 (home-page "https://pyusb.github.io/pyusb/") 375 (home-page "https://pyusb.github.io/pyusb/")
380 (synopsis "Python bindings to the libusb library") 376 (synopsis "Python bindings to the libusb library")
381 (description 377 (description