GNU bug report logs - #29850
[PATCH] gnu: Add python-hidapi.

Previous Next

Package: guix-patches;

Reported by: Danny Milosavljevic <dannym <at> scratchpost.org>

Date: Mon, 25 Dec 2017 23:04:02 UTC

Severity: normal

Tags: patch

Done: Danny Milosavljevic <dannym <at> scratchpost.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 29850 in the body.
You can then email your comments to 29850 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#29850; Package guix-patches. (Mon, 25 Dec 2017 23:04:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 25 Dec 2017 23:04:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: <guix-patches <at> gnu.org>
Subject: [PATCH] gnu: Add python-hidapi.
Date: Tue, 26 Dec 2017 00:03:19 +0100
* gnu/packages/libusb.scm (python-hidapi, python2-hidapi): New variables.
---
 gnu/packages/libusb.scm | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index 31c7dfa44..404ae8659 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -352,3 +352,40 @@ HID-Class devices.")
     (license (list gpl3
                    bsd-3
                    (non-copyleft "file://LICENSE-orig.txt")))))
+
+(define-public python-hidapi
+  (package
+    (name "python-hidapi")
+    (version "0.7.99.post21")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "hidapi" version))
+        (sha256
+          (base32
+            "15ws59zdrxahf3k7z5rcrwc4jgv1307anif8ixm2cyb9ask1mgp0"))))
+    (build-system python-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'")))
+             #t)))))
+    (inputs
+     `(("libusb" ,libusb)
+       ("eudev" ,eudev)))
+    (native-inputs
+     `(("python-cython" ,python-cython)))
+    (home-page "https://github.com/trezor/cython-hidapi")
+    (synopsis "Cython interface to hidapi")
+    (description "A Cython interface to the hidapi.")
+    ;; The library can be used under either of these licenses.
+    ;; TODO cython-hidapi DIY license.
+    (license (list gpl3 bsd-3))))
+
+(define-public python2-hidapi
+  (package-with-python2 python-hidapi))




Information forwarded to guix-patches <at> gnu.org:
bug#29850; Package guix-patches. (Tue, 26 Dec 2017 18:45:02 GMT) Full text and rfc822 format available.

Message #8 received at 29850 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 29850 <at> debbugs.gnu.org
Subject: Re: [bug#29850] [PATCH] gnu: Add python-hidapi.
Date: Tue, 26 Dec 2017 13:44:14 -0500
[Message part 1 (text/plain, inline)]
On Tue, Dec 26, 2017 at 12:03:19AM +0100, Danny Milosavljevic wrote:
> * gnu/packages/libusb.scm (python-hidapi, python2-hidapi): New variables.

> +    (synopsis "Cython interface to hidapi")
> +    (description "A Cython interface to the hidapi.")

Please make it a complete English sentence:

This package provides a Cython interface to the HIDAPI library.

Otherwise LGTM!
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#29850; Package guix-patches. (Wed, 27 Dec 2017 00:24:01 GMT) Full text and rfc822 format available.

Message #11 received at 29850 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: Leo Famulari <leo <at> famulari.name>
Cc: 29850 <at> debbugs.gnu.org
Subject: Re: [bug#29850] [PATCH] gnu: Add python-hidapi.
Date: Wed, 27 Dec 2017 01:23:49 +0100
On Tue, 26 Dec 2017 13:44:14 -0500
Leo Famulari <leo <at> famulari.name> wrote:

> On Tue, Dec 26, 2017 at 12:03:19AM +0100, Danny Milosavljevic wrote:
> > * gnu/packages/libusb.scm (python-hidapi, python2-hidapi): New variables.  
> 
> > +    (synopsis "Cython interface to hidapi")
> > +    (description "A Cython interface to the hidapi.")  
> 
> Please make it a complete English sentence:
> 
> This package provides a Cython interface to the HIDAPI library.

Okay.

What about the extra license?




Information forwarded to guix-patches <at> gnu.org:
bug#29850; Package guix-patches. (Wed, 27 Dec 2017 11:28:02 GMT) Full text and rfc822 format available.

Message #14 received at 29850 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: 29850 <at> debbugs.gnu.org
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: [PATCH v2] gnu: Add python-hidapi.
Date: Wed, 27 Dec 2017 12:27:10 +0100
* gnu/packages/libusb.scm (python-hidapi, python2-hidapi): New variables.
---
 gnu/packages/libusb.scm | 60 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index 31c7dfa44..7dd9a41eb 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -352,3 +352,63 @@ HID-Class devices.")
     (license (list gpl3
                    bsd-3
                    (non-copyleft "file://LICENSE-orig.txt")))))
+
+(define-public python-hidapi
+  (package
+    (name "python-hidapi")
+    (version "0.7.99.post21")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "hidapi" version))
+        (sha256
+          (base32
+            "15ws59zdrxahf3k7z5rcrwc4jgv1307anif8ixm2cyb9ask1mgp0"))
+        (modules '((guix build utils)))
+        (snippet
+         ;; Remove bundled libraries.
+         '(begin
+            (delete-file-recursively "hidapi")))))
+    (build-system python-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))
+         (replace 'build
+           (lambda _
+             ;; Necessary because python-build-system drops the arguments.
+             (invoke "python" "setup.py" "build" "--with-system-hidapi")))
+         (replace 'check
+           (lambda _
+             ;; Necessary because python-build-system drops the arguments.
+             (invoke "python" "setup.py" "test" "--with-system-hidapi")))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; Necessary because python-build-system drops the arguments.
+             (invoke "python" "setup.py" "install" "--with-system-hidapi"
+                     (string-append "--prefix=" (assoc-ref outputs "out"))
+                     "--single-version-externally-managed" "--root=/"))))))
+    (inputs
+     `(("hidapi" ,hidapi)
+       ("libusb" ,libusb)
+       ("eudev" ,eudev)))
+    (native-inputs
+     `(("python-cython" ,python-cython)))
+    (home-page "https://github.com/trezor/cython-hidapi")
+    (synopsis "Cython interface to hidapi")
+    (description "This package provides a Cython interface to @code{hidapi}.")
+    ;; The library can be used under either of these licenses.
+    ;; TODO Add cython-hidapi DIY license?
+    (license (list gpl3 bsd-3))))
+
+(define-public python2-hidapi
+  (package-with-python2 python-hidapi))




Information forwarded to guix-patches <at> gnu.org:
bug#29850; Package guix-patches. (Wed, 27 Dec 2017 19:21:01 GMT) Full text and rfc822 format available.

Message #17 received at 29850 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 29850 <at> debbugs.gnu.org
Subject: Re: [bug#29850] [PATCH] gnu: Add python-hidapi.
Date: Wed, 27 Dec 2017 14:20:24 -0500
[Message part 1 (text/plain, inline)]
On Wed, Dec 27, 2017 at 01:23:49AM +0100, Danny Milosavljevic wrote:
> On Tue, 26 Dec 2017 13:44:14 -0500
> Leo Famulari <leo <at> famulari.name> wrote:
> 
> > On Tue, Dec 26, 2017 at 12:03:19AM +0100, Danny Milosavljevic wrote:
> > > * gnu/packages/libusb.scm (python-hidapi, python2-hidapi): New variables.  
> > 
> > > +    (synopsis "Cython interface to hidapi")
> > > +    (description "A Cython interface to the hidapi.")  
> > 
> > Please make it a complete English sentence:
> > 
> > This package provides a Cython interface to the HIDAPI library.
> 
> Okay.
> 
> What about the extra license?

I would add it to the list of licenses in the license field using the
non-copyleft procedure. If you've never used non-copyleft, note that it
is a procedure that takes a URI and comment as arguments.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#29850; Package guix-patches. (Wed, 27 Dec 2017 19:54:02 GMT) Full text and rfc822 format available.

Message #20 received at 29850 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: 29850 <at> debbugs.gnu.org
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: [PATCH v3] gnu: Add python-hidapi.
Date: Wed, 27 Dec 2017 20:53:51 +0100
* gnu/packages/libusb.scm (python-hidapi, python2-hidapi): New variables.
---
 gnu/packages/libusb.scm | 62 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index 31c7dfa44..b4db9e851 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -352,3 +352,65 @@ HID-Class devices.")
     (license (list gpl3
                    bsd-3
                    (non-copyleft "file://LICENSE-orig.txt")))))
+
+(define-public python-hidapi
+  (package
+    (name "python-hidapi")
+    (version "0.7.99.post21")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "hidapi" version))
+        (sha256
+          (base32
+            "15ws59zdrxahf3k7z5rcrwc4jgv1307anif8ixm2cyb9ask1mgp0"))
+        (modules '((guix build utils)))
+        (snippet
+         ;; Remove bundled libraries.
+         '(begin
+            (delete-file-recursively "hidapi")))))
+    (build-system python-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))
+         (replace 'build
+           (lambda _
+             ;; Necessary because python-build-system drops the arguments.
+             (invoke "python" "setup.py" "build" "--with-system-hidapi")))
+         (replace 'check
+           (lambda _
+             ;; Necessary because python-build-system drops the arguments.
+             (invoke "python" "setup.py" "test" "--with-system-hidapi")))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; Necessary because python-build-system drops the arguments.
+             (invoke "python" "setup.py" "install" "--with-system-hidapi"
+                     (string-append "--prefix=" (assoc-ref outputs "out"))
+                     "--single-version-externally-managed" "--root=/"))))))
+    (inputs
+     `(("hidapi" ,hidapi)
+       ("libusb" ,libusb)
+       ("eudev" ,eudev)))
+    (native-inputs
+     `(("python-cython" ,python-cython)))
+    (home-page "https://github.com/trezor/cython-hidapi")
+    (synopsis "Cython interface to hidapi")
+    (description "This package provides a Cython interface to @code{hidapi}.")
+    ;; The library can be used under either of these licenses.
+    ;; TODO Add cython-hidapi DIY license?
+    (license (list gpl3 bsd-3
+                   (non-copyleft
+                    "https://github.com/trezor/cython-hidapi/blob/master/LICENSE-orig.txt")))))
+
+(define-public python2-hidapi
+  (package-with-python2 python-hidapi))




Information forwarded to guix-patches <at> gnu.org:
bug#29850; Package guix-patches. (Wed, 27 Dec 2017 21:59:02 GMT) Full text and rfc822 format available.

Message #23 received at 29850 <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: Danny Milosavljevic <dannym <at> scratchpost.org>, 29850 <at> debbugs.gnu.org
Subject: Re: [bug#29850] [PATCH v3] gnu: Add python-hidapi.
Date: Wed, 27 Dec 2017 22:58:03 +0100
[Message part 1 (text/plain, inline)]
Hello!

Danny Milosavljevic <dannym <at> scratchpost.org> writes:

> * gnu/packages/libusb.scm (python-hidapi, python2-hidapi): New variables.

[...]

> +(define-public python-hidapi
> +  (package
> +    (name "python-hidapi")
> +    (version "0.7.99.post21")
> +    (source
> +      (origin
> +        (method url-fetch)
> +        (uri (pypi-uri "hidapi" version))
> +        (sha256
> +          (base32
> +            "15ws59zdrxahf3k7z5rcrwc4jgv1307anif8ixm2cyb9ask1mgp0"))

Please re-indent the entire expression with emacs or ./etc/indent-code.el.

> +        (modules '((guix build utils)))
> +        (snippet
> +         ;; Remove bundled libraries.
> +         '(begin
> +            (delete-file-recursively "hidapi")))))

In absense of a consensus on unspecified return values, return #t here.

> +    (build-system python-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))
> +         (replace 'build
> +           (lambda _
> +             ;; Necessary because python-build-system drops the arguments.
> +             (invoke "python" "setup.py" "build" "--with-system-hidapi")))
> +         (replace 'check
> +           (lambda _
> +             ;; Necessary because python-build-system drops the arguments.
> +             (invoke "python" "setup.py" "test" "--with-system-hidapi")))
> +         (replace 'install
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             ;; Necessary because python-build-system drops the arguments.
> +             (invoke "python" "setup.py" "install" "--with-system-hidapi"
> +                     (string-append "--prefix=" (assoc-ref outputs "out"))
> +                     "--single-version-externally-managed" "--root=/"))))))

I don't think repeating the same comment thrice is necessary.  Maybe
just add an XXX note at the top mentioning why we do this dance rather
than use python-build-system directly.

It would be good to extend python-build-system to support this however.
#:setuppy-flags? :)

> +    (inputs
> +     `(("hidapi" ,hidapi)
> +       ("libusb" ,libusb)
> +       ("eudev" ,eudev)))
> +    (native-inputs
> +     `(("python-cython" ,python-cython)))
> +    (home-page "https://github.com/trezor/cython-hidapi")
> +    (synopsis "Cython interface to hidapi")
> +    (description "This package provides a Cython interface to @code{hidapi}.")
> +    ;; The library can be used under either of these licenses.
> +    ;; TODO Add cython-hidapi DIY license?

I think this TODO can be removed, we have lots of "one-off" licenses
scattered throughout.

> +    (license (list gpl3 bsd-3
> +                   (non-copyleft
> +                    "https://github.com/trezor/cython-hidapi/blob/master/LICENSE-orig.txt")))))

The (non-copyleft ...) procedure takes an optional comment.  This
license is short enough to fit, maybe we can just add the "whole" text?

No strong opinion.  The rest LGTM!

> +
> +(define-public python2-hidapi
> +  (package-with-python2 python-hidapi))
[signature.asc (application/pgp-signature, inline)]

Reply sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
You have taken responsibility. (Thu, 28 Dec 2017 07:42:02 GMT) Full text and rfc822 format available.

Notification sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
bug acknowledged by developer. (Thu, 28 Dec 2017 07:42:02 GMT) Full text and rfc822 format available.

Message #28 received at 29850-done <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: Marius Bakke <mbakke <at> fastmail.com>
Cc: 29850-done <at> debbugs.gnu.org
Subject: Re: [bug#29850] [PATCH v3] gnu: Add python-hidapi.
Date: Thu, 28 Dec 2017 08:41:00 +0100
Hi Marius,

thanks for the review!  Fixed these and pushed that patch to master.

> It would be good to extend python-build-system to support this however.
#:setuppy-flags? :)

I agree.  But I think Hartmut said that the arguments aren't necessarily the same for build, install and check.  Let's see...




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 25 Jan 2018 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 153 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.