Subject: [bug#31957] [PATCH] gnu: Add python-libusb1.

From: Vagrant Cascadian <[email-masked]>
Date: Sun, 24 Jun 2018 13:04:06 -0700

Add new package definition for python-libusb1, needed to upgrade
python-trezor to newer versions.

live well,
  vagrant

From 282280cbaba47389f7a9c3e14eb8fe7834adbd39 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <[email-masked]>
Date: Sun, 24 Jun 2018 19:20:47 +0000
Subject: [PATCH] gnu: Add python-libusb1.

* gnu/packages/libusb.scm (python-libusb1): New variable.
---
 gnu/packages/libusb.scm | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index 62c936c19..9fa2d816a 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -214,6 +214,44 @@ with usb4java.")
 implementing @code{javax.usb} (JSR-80).")
     (license expat)))
 
+(define-public python-libusb1
+  (package
+    (name "python-libusb1")
+    (version "1.6.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "libusb1" version))
+       (sha256
+        (base32
+         "03b7xrz8vqg8w0za5r503jhcmbd1ls5610jcja1rqz833nf0v4wc"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:modules ((srfi srfi-1)
+                  (srfi srfi-26)
+                  (guix build utils)
+                  (guix build python-build-system))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-libusb-reference
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "usb1/libusb1.py"
+               (("libusb_path = ctypes.util.find_library\\(base_name\\)")
+                (string-append
+                 "libusb_path = \""
+                 (find (negate symbolic-link?)
+                       (find-files (assoc-ref inputs "libusb")
+                                   "^libusb.*\\.so\\..*"))
+                 "\"")))
+             #t)))))
+    (inputs `(("libusb" ,libusb)))
+    (home-page
+     "http://github.com/vpelletier/python-libusb1")
+    (synopsis "Pure-python wrapper for libusb-1.0")
+    (description
+     "Pure-python wrapper for libusb-1.0")
+    (license lgpl2.1+)))
+
 (define-public python-pyusb
   (package
     (name "python-pyusb")
-- 
2.11.0