summary refs log tree commit diff
path: root/gnu/packages/libusb.scm
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2016-03-29 09:06:09 +0200
committerRicardo Wurmus <rekado@elephly.net>2016-04-17 21:48:51 +0200
commitfac34dfe2a576907bf9f612d8ed8f4e9dee826be (patch)
treef584eab701cf6746ea9e80cf6547650c12f5c194 /gnu/packages/libusb.scm
parentd99f6ffb4caa66fd070297838fdb6593b5c80e2d (diff)
downloadguix-fac34dfe2a576907bf9f612d8ed8f4e9dee826be.tar.gz
gnu: Add python-pyusb.
* gnu/packages/libusb.scm (python-pyusb, python2-pyusb): New variables.
Diffstat (limited to 'gnu/packages/libusb.scm')
-rw-r--r--gnu/packages/libusb.scm47
1 files changed, 46 insertions, 1 deletions
diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index 61136791d3..1e72442c73 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
-;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -28,11 +28,13 @@
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system glib-or-gtk)
+  #:use-module (guix build-system python)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages mp3)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages xiph))
 
 (define-public libusb
@@ -87,6 +89,49 @@ devices on various operating systems.")
 version of libusb to run with newer libusb.")
     (license lgpl2.1+)))
 
+(define-public python-pyusb
+  (package
+    (name "python-pyusb")
+    (version "1.0.0rc1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "pyusb" version))
+       (sha256
+        (base32
+         "07cjq11qhngzjd746k7688s6y2x7lpj669fxqfsiy985rg0jsn7j"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:tests? #f  ;no tests
+       #:modules ((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* "usb/libloader.py"
+               (("lib = locate_library\\(candidates, find_library\\)")
+                (string-append
+                 "lib = \""
+                 (car (find-files (assoc-ref inputs "libusb")
+                                  (lambda (file stat)
+                                    (and ((file-name-predicate
+                                           "^libusb-.*\\.so\\..*") file stat)
+                                         (not (symbolic-link? file))))))
+                 "\"")))
+             #t)))))
+    (inputs
+     `(("libusb" ,libusb)))
+    (home-page "http://walac.github.io/pyusb/")
+    (synopsis "Python bindings to the libusb library")
+    (description
+     "PyUSB aims to be an easy to use Python module to access USB devices.")
+    (license bsd-3)))
+
+(define-public python2-pyusb
+  (package-with-python2 python-pyusb))
+
 (define-public libmtp
   (package
     (name "libmtp")