unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Add pyusb.
@ 2016-03-29  7:07 Ricardo Wurmus
  2016-03-30  2:27 ` Eric Bavier
  0 siblings, 1 reply; 5+ messages in thread
From: Ricardo Wurmus @ 2016-03-29  7:07 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: 0001-gnu-Add-python-pyusb.patch --]
[-- Type: text/x-patch, Size: 2850 bytes --]

From a5a632c0f11d650a8e3bcae64ea8680aa90d3cf6 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Tue, 29 Mar 2016 09:06:09 +0200
Subject: [PATCH] gnu: Add python-pyusb.

* gnu/packages/libusb.scm (python-pyusb, python2-pyusb): New variables.
---
 gnu/packages/libusb.scm | 40 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index c3427e7..82ff743 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,42 @@ 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
+       #: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 = \""
+                               (assoc-ref inputs "libusb")
+                               "/lib/libusb-1.0.so.0.1.0"
+                               "\"")))
+             #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")
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add pyusb.
  2016-03-29  7:07 [PATCH] Add pyusb Ricardo Wurmus
@ 2016-03-30  2:27 ` Eric Bavier
  2016-03-30  6:07   ` Ricardo Wurmus
  2016-03-30  6:47   ` Ricardo Wurmus
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Bavier @ 2016-03-30  2:27 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

On Tue, 29 Mar 2016 09:07:44 +0200
Ricardo Wurmus <rekado@elephly.net> wrote:

> From a5a632c0f11d650a8e3bcae64ea8680aa90d3cf6 Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <rekado@elephly.net>
> Date: Tue, 29 Mar 2016 09:06:09 +0200
> Subject: [PATCH] gnu: Add python-pyusb.
> 
> * gnu/packages/libusb.scm (python-pyusb, python2-pyusb): New variables.
> ---
>  gnu/packages/libusb.scm | 40 +++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 39 insertions(+), 1 deletion(-)
> 
[...]
> @@ -87,6 +89,42 @@ 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
> +       #: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 = \""
> +                               (assoc-ref inputs "libusb")
> +                               "/lib/libusb-1.0.so.0.1.0"

Is there any way to derive the soversion to help avoid breakage from
future libusb updates?

`~Eric

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add pyusb.
  2016-03-30  2:27 ` Eric Bavier
@ 2016-03-30  6:07   ` Ricardo Wurmus
  2016-03-30  6:47   ` Ricardo Wurmus
  1 sibling, 0 replies; 5+ messages in thread
From: Ricardo Wurmus @ 2016-03-30  6:07 UTC (permalink / raw)
  To: Eric Bavier; +Cc: guix-devel


Eric Bavier <ericbavier@openmailbox.org> writes:

> On Tue, 29 Mar 2016 09:07:44 +0200
> Ricardo Wurmus <rekado@elephly.net> wrote:
>
>> From a5a632c0f11d650a8e3bcae64ea8680aa90d3cf6 Mon Sep 17 00:00:00 2001
>> From: Ricardo Wurmus <rekado@elephly.net>
>> Date: Tue, 29 Mar 2016 09:06:09 +0200
>> Subject: [PATCH] gnu: Add python-pyusb.
>> 
>> * gnu/packages/libusb.scm (python-pyusb, python2-pyusb): New variables.
>> ---
>>  gnu/packages/libusb.scm | 40 +++++++++++++++++++++++++++++++++++++++-
>>  1 file changed, 39 insertions(+), 1 deletion(-)
>> 
> [...]
>> @@ -87,6 +89,42 @@ 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
>> +       #: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 = \""
>> +                               (assoc-ref inputs "libusb")
>> +                               "/lib/libusb-1.0.so.0.1.0"
>
> Is there any way to derive the soversion to help avoid breakage from
> future libusb updates?

I don’t know where the name comes from.  I could certainly just look in
the “lib” directory of the “libusb” input and take the first
“libusb*.so.*” file that’s not a symlink.

~~ Ricardo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add pyusb.
  2016-03-30  2:27 ` Eric Bavier
  2016-03-30  6:07   ` Ricardo Wurmus
@ 2016-03-30  6:47   ` Ricardo Wurmus
  2016-04-07 20:49     ` Ludovic Courtès
  1 sibling, 1 reply; 5+ messages in thread
From: Ricardo Wurmus @ 2016-03-30  6:47 UTC (permalink / raw)
  To: Eric Bavier; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1740 bytes --]


Eric Bavier <ericbavier@openmailbox.org> writes:

> On Tue, 29 Mar 2016 09:07:44 +0200
> Ricardo Wurmus <rekado@elephly.net> wrote:
>
>> From a5a632c0f11d650a8e3bcae64ea8680aa90d3cf6 Mon Sep 17 00:00:00 2001
>> From: Ricardo Wurmus <rekado@elephly.net>
>> Date: Tue, 29 Mar 2016 09:06:09 +0200
>> Subject: [PATCH] gnu: Add python-pyusb.
>> 
>> * gnu/packages/libusb.scm (python-pyusb, python2-pyusb): New variables.
>> ---
>>  gnu/packages/libusb.scm | 40 +++++++++++++++++++++++++++++++++++++++-
>>  1 file changed, 39 insertions(+), 1 deletion(-)
>> 
> [...]
>> @@ -87,6 +89,42 @@ 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
>> +       #: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 = \""
>> +                               (assoc-ref inputs "libusb")
>> +                               "/lib/libusb-1.0.so.0.1.0"
>
> Is there any way to derive the soversion to help avoid breakage from
> future libusb updates?

How about the attached patch?

~~ Ricardo


[-- Attachment #2: 0001-gnu-Add-python-pyusb.patch --]
[-- Type: text/x-patch, Size: 3203 bytes --]

From 2f190da0d812501a4ab3db94a99ac8f7c6698cbc Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Tue, 29 Mar 2016 09:06:09 +0200
Subject: [PATCH] gnu: Add python-pyusb.

* gnu/packages/libusb.scm (python-pyusb, python2-pyusb): New variables.
---
 gnu/packages/libusb.scm | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index c3427e7..ffd1273 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")
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add pyusb.
  2016-03-30  6:47   ` Ricardo Wurmus
@ 2016-04-07 20:49     ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2016-04-07 20:49 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <rekado@elephly.net> skribis:

> From 2f190da0d812501a4ab3db94a99ac8f7c6698cbc Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <rekado@elephly.net>
> Date: Tue, 29 Mar 2016 09:06:09 +0200
> Subject: [PATCH] gnu: Add python-pyusb.
>
> * gnu/packages/libusb.scm (python-pyusb, python2-pyusb): New variables.

[...]

> +           (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))))))

Maybe (with SRFI-1):

  (find (negate symbolic-link?)
        (find-files (assoc-ref inputs "libusb")
                    "^libusb-.*\\.so\\..*"))

But really this is nitpicking, the patch should go in.  :-)

Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-04-07 20:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-29  7:07 [PATCH] Add pyusb Ricardo Wurmus
2016-03-30  2:27 ` Eric Bavier
2016-03-30  6:07   ` Ricardo Wurmus
2016-03-30  6:47   ` Ricardo Wurmus
2016-04-07 20:49     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).