unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#29850] [PATCH] gnu: Add python-hidapi.
@ 2017-12-25 23:03 Danny Milosavljevic
  2017-12-26 18:44 ` Leo Famulari
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Danny Milosavljevic @ 2017-12-25 23:03 UTC (permalink / raw)
  To: 29850

* 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))

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

* [bug#29850] [PATCH] gnu: Add python-hidapi.
  2017-12-25 23:03 [bug#29850] [PATCH] gnu: Add python-hidapi Danny Milosavljevic
@ 2017-12-26 18:44 ` Leo Famulari
  2017-12-27  0:23   ` Danny Milosavljevic
  2017-12-27 11:27 ` [bug#29850] [PATCH v2] " Danny Milosavljevic
  2017-12-27 19:53 ` [bug#29850] [PATCH v3] " Danny Milosavljevic
  2 siblings, 1 reply; 8+ messages in thread
From: Leo Famulari @ 2017-12-26 18:44 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 29850

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

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!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [bug#29850] [PATCH] gnu: Add python-hidapi.
  2017-12-26 18:44 ` Leo Famulari
@ 2017-12-27  0:23   ` Danny Milosavljevic
  2017-12-27 19:20     ` Leo Famulari
  0 siblings, 1 reply; 8+ messages in thread
From: Danny Milosavljevic @ 2017-12-27  0:23 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 29850

On Tue, 26 Dec 2017 13:44:14 -0500
Leo Famulari <leo@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?

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

* [bug#29850] [PATCH v2] gnu: Add python-hidapi.
  2017-12-25 23:03 [bug#29850] [PATCH] gnu: Add python-hidapi Danny Milosavljevic
  2017-12-26 18:44 ` Leo Famulari
@ 2017-12-27 11:27 ` Danny Milosavljevic
  2017-12-27 19:53 ` [bug#29850] [PATCH v3] " Danny Milosavljevic
  2 siblings, 0 replies; 8+ messages in thread
From: Danny Milosavljevic @ 2017-12-27 11:27 UTC (permalink / raw)
  To: 29850

* 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))

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

* [bug#29850] [PATCH] gnu: Add python-hidapi.
  2017-12-27  0:23   ` Danny Milosavljevic
@ 2017-12-27 19:20     ` Leo Famulari
  0 siblings, 0 replies; 8+ messages in thread
From: Leo Famulari @ 2017-12-27 19:20 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 29850

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

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@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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [bug#29850] [PATCH v3] gnu: Add python-hidapi.
  2017-12-25 23:03 [bug#29850] [PATCH] gnu: Add python-hidapi Danny Milosavljevic
  2017-12-26 18:44 ` Leo Famulari
  2017-12-27 11:27 ` [bug#29850] [PATCH v2] " Danny Milosavljevic
@ 2017-12-27 19:53 ` Danny Milosavljevic
  2017-12-27 21:58   ` Marius Bakke
  2 siblings, 1 reply; 8+ messages in thread
From: Danny Milosavljevic @ 2017-12-27 19:53 UTC (permalink / raw)
  To: 29850

* 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))

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

* [bug#29850] [PATCH v3] gnu: Add python-hidapi.
  2017-12-27 19:53 ` [bug#29850] [PATCH v3] " Danny Milosavljevic
@ 2017-12-27 21:58   ` Marius Bakke
  2017-12-28  7:41     ` bug#29850: " Danny Milosavljevic
  0 siblings, 1 reply; 8+ messages in thread
From: Marius Bakke @ 2017-12-27 21:58 UTC (permalink / raw)
  To: Danny Milosavljevic, 29850

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

Hello!

Danny Milosavljevic <dannym@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))

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* bug#29850: [PATCH v3] gnu: Add python-hidapi.
  2017-12-27 21:58   ` Marius Bakke
@ 2017-12-28  7:41     ` Danny Milosavljevic
  0 siblings, 0 replies; 8+ messages in thread
From: Danny Milosavljevic @ 2017-12-28  7:41 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 29850-done

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...

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

end of thread, other threads:[~2017-12-28  7:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-25 23:03 [bug#29850] [PATCH] gnu: Add python-hidapi Danny Milosavljevic
2017-12-26 18:44 ` Leo Famulari
2017-12-27  0:23   ` Danny Milosavljevic
2017-12-27 19:20     ` Leo Famulari
2017-12-27 11:27 ` [bug#29850] [PATCH v2] " Danny Milosavljevic
2017-12-27 19:53 ` [bug#29850] [PATCH v3] " Danny Milosavljevic
2017-12-27 21:58   ` Marius Bakke
2017-12-28  7:41     ` bug#29850: " Danny Milosavljevic

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).