guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#42682] [PATCH v2 7/9] gnu: Add python-hid.


From: Fredrik Salomonsson
Subject: [bug#42682] [PATCH v2 7/9] gnu: Add python-hid.
Date: Sun, 9 Apr 2023 04:31:14 +0000

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

diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index c009c78e88..266ab459a1 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2022 Jacob Hrbek <kreyren@rixotstudio.cz>
 ;;; Copyright © 2023 Sharlatan Hellseher <sharlatanus@gmail.com>
+;;; Copyright © 2023 Fredrik Salomonsson <plattfot@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -44,6 +45,7 @@ (define-module (gnu packages libusb)
   #:use-module (guix build-system pyproject)
   #:use-module (guix build-system python)
   #:use-module (gnu packages autotools)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages gnupg)
@@ -54,6 +56,7 @@ (define-module (gnu packages libusb)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-build)
+  #:use-module (gnu packages python-check)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages tls)
@@ -650,6 +653,59 @@ (define-public hidapi
                    license:bsd-3
                    (license:non-copyleft "file://LICENSE-orig.txt")))))
 
+(define-public python-hid
+  (package
+    (name "python-hid")
+    (version "1.0.5")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "hid" version))
+              (sha256
+               (base32
+                "1s5hvfbmnlmifswr5514f4xxn5rcd429bdcdqzgwkdxrg9zlx58y"))))
+    (build-system python-build-system)
+    (arguments
+       (list
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'patch-library-paths
+              (lambda* (#:key inputs #:allow-other-keys)
+                (substitute* '("hid/__init__.py")
+                  (("'libhidapi-hidraw.so'")
+                   (string-append
+                    "'" (search-input-file inputs "/lib/libhidapi-hidraw.so") 
"'"))
+                  (("'libhidapi-libusb.so'")
+                   (string-append
+                    "'" (search-input-file inputs "/lib/libhidapi-libusb.so") 
"'"))
+                  ;; Nuke the rest of the library_paths
+                  (("[[:blank:]]+'libhidapi-hidraw.so.0',\n")
+                   "")
+                  (("[[:blank:]]+'libhidapi-libusb.so.0',\n")
+                   "")
+                  (("[[:blank:]]+'libhidapi-iohidmanager.so',\n")
+                   "")
+                  (("[[:blank:]]+'libhidapi-iohidmanager.so.0',\n")
+                   "")
+                  (("[[:blank:]]+'libhidapi.dylib',\n")
+                   "")
+                  (("[[:blank:]]+'hidapi.dll',\n")
+                   "")
+                  (("[[:blank:]]+'hidapi-0.dll',\n")
+                   "")))))))
+    (native-inputs
+     (list
+      python-nose
+      python-tox))
+    (inputs
+     (list
+      hidapi))
+    (home-page "https://github.com/apmorton/pyhidapi";)
+    (synopsis "Ctypes bindings for hidapi")
+    (description "This package provides ctypes bindings in Python for the 
@code{hidapi}
+package.  Note that this package conflicts with the
+@code{python-hidapi} package as they occupy the same Python namespace.")
+    (license license:expat)))
+
 (define-public python-hidapi
   (package
     (name "python-hidapi")
-- 
2.39.2






reply via email to

[Prev in Thread] Current Thread [Next in Thread]