GNU bug report logs - #65911
[PATCH 0/4] gnu: Add liquidctl.

Previous Next

Package: guix-patches;

Reported by: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>

Date: Wed, 13 Sep 2023 09:55:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.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 65911 in the body.
You can then email your comments to 65911 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#65911; Package guix-patches. (Wed, 13 Sep 2023 09:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 13 Sep 2023 09:55:02 GMT) Full text and rfc822 format available.

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

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: guix-patches <at> gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH 0/4] gnu: Add liquidctl.
Date: Wed, 13 Sep 2023 11:53:41 +0200
This patch series adds the liquidctl package, a tool to manage liquid
cooling hardware.

Adds the python-smbus dependency and also adds libusb-compat as a
back-end for python-pyusb while enabling tests and fixing a bug when
libusb initialization results in an error as it would try to use the
libusb library for the openusb back-end which would result in symbol
errors.

Jean-Pierre De Jesus DIAZ (4):
  gnu: Add python-smbus.
  gnu: python-pyusb: Use G-Expressions.
  gnu: python-pyusb: Add libusb-compat backend.
  gnu: Add liquidctl.

 gnu/packages/hardware.scm | 39 +++++++++++++++++++++++
 gnu/packages/libusb.scm   | 67 +++++++++++++++++++++++++++------------
 gnu/packages/linux.scm    | 24 ++++++++++++++
 3 files changed, 110 insertions(+), 20 deletions(-)


base-commit: d4645d5d25c9de0def9745c48a96504e500ec850
-- 
2.34.1





Information forwarded to guix-patches <at> gnu.org:
bug#65911; Package guix-patches. (Wed, 13 Sep 2023 09:57:02 GMT) Full text and rfc822 format available.

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

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 65911 <at> debbugs.gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH 1/4] gnu: Add python-smbus.
Date: Wed, 13 Sep 2023 11:55:56 +0200
* gnu/packages/linux.scm (python-smbus): New variable.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
---
 gnu/packages/linux.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 36354b4d82..e57ab866c6 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -75,6 +75,7 @@
 ;;; Copyright © 2023 Yovan Naumovski <yovan <at> gorski.stream>
 ;;; Copyright © 2023 Zheng Junjie <873216071 <at> qq.com>
 ;;; Copyright © 2023 dan <i <at> dan.games>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello <at> foundationdevices.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -188,6 +189,7 @@ (define-module (gnu packages linux)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
   #:use-module (guix build-system meson)
+  #:use-module (guix build-system pyproject)
   #:use-module (guix build-system python)
   #:use-module (guix build-system trivial)
   #:use-module (guix build-system linux-module)
@@ -4921,6 +4923,28 @@ (define-public i2c-tools-3
         #~(list (string-append "prefix=" #$output)
                 (string-append "CC=" #$(cc-for-target))))))))
 
+(define-public python-smbus
+  (package
+    (inherit i2c-tools)
+    (name "python-smbus")
+    (build-system pyproject-build-system)
+    (arguments
+     (list #:tests? #f ;; No test suite.
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'change-directory
+                 (lambda _ (chdir "py-smbus")))
+               (add-after 'change-directory 'set-library-path
+                 (lambda _
+                   (substitute* "setup.py"
+                     (("-L\\.\\./lib")
+                      (string-append "-L" #$i2c-tools "/lib"))))))))
+    (inputs (list i2c-tools))
+    (synopsis "I2C/SMBus access for Python")
+    (description "This package provides a Python library to access
+@acronym{I2C, Inter-Integrated Circuit} and @acronym{SMBus, System
+Management Bus} devices on Linux.")))
+
 (define-public xsensors
   (package
     (name "xsensors")
-- 
2.34.1





Information forwarded to guix-patches <at> gnu.org:
bug#65911; Package guix-patches. (Wed, 13 Sep 2023 09:57:02 GMT) Full text and rfc822 format available.

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

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 65911 <at> debbugs.gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH 2/4] gnu: python-pyusb: Use G-Expressions.
Date: Wed, 13 Sep 2023 11:55:57 +0200
* gnu/packages/usb.scm (python-pyusb) <arguments>: Use G-Expressions
  style instead of quoting.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
---
 gnu/packages/libusb.scm | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index e615b81ea3..469882e871 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -288,24 +288,23 @@ (define-public python-pyusb
          "1fg7knfzybzija2b01pzrzhzsj989scl12sb2ra4f503l8279k54"))))
     (build-system python-build-system)
     (arguments
-     `(#:tests? #f                      ; no tests
-       #:modules ((srfi srfi-1)
-                  (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 = \""
-                 (find (negate symbolic-link?)
-                       (find-files (assoc-ref inputs "libusb")
-                                   "^libusb-.*\\.so\\..*"))
-                 "\"")))
-             #t)))))
+     (list #:tests? #f                      ; no tests
+           #:modules '((srfi srfi-1)
+                       (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 = \""
+                       (find (negate symbolic-link?)
+                             (find-files (assoc-ref inputs "libusb")
+                                         "^libusb-.*\\.so\\..*"))
+                       "\""))))))))
 
     (native-inputs
      (list python-setuptools-scm))
-- 
2.34.1





Information forwarded to guix-patches <at> gnu.org:
bug#65911; Package guix-patches. (Wed, 13 Sep 2023 09:57:03 GMT) Full text and rfc822 format available.

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

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 65911 <at> debbugs.gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH 3/4] gnu: python-pyusb: Add libusb-compat backend.
Date: Wed, 13 Sep 2023 11:55:58 +0200
* gnu/packages/libusb.scm (python-pyusb) <arguments>: Do not hard-code
  libusb1 library for all back-ends, and allow to use libusb0 as a
  back-end.  Also enabled tests as the package does have a test suite.

* gnu/packages/libusb.scm (python-pyusb) <inputs>: Add libusb-compat.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
---
 gnu/packages/libusb.scm | 52 +++++++++++++++++++++++++++++++----------
 1 file changed, 40 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index 469882e871..d15e561668 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -288,28 +288,56 @@ (define-public python-pyusb
          "1fg7knfzybzija2b01pzrzhzsj989scl12sb2ra4f503l8279k54"))))
     (build-system python-build-system)
     (arguments
-     (list #:tests? #f                      ; no tests
-           #:modules '((srfi srfi-1)
+     (list #:modules '((srfi srfi-1)
                        (srfi srfi-26)
                        (guix build utils)
                        (guix build python-build-system))
            #:phases
            #~(modify-phases %standard-phases
+               ;; Repurpose the candidates parameter to be the path to the
+               ;; library, then on each backend we substitute the candidates
+               ;; with the full path to the .so library or with None if not
+               ;; supported.
+               ;;
+               ;; While most applications could use a single back-end this
+               ;; library allows to manually select the back-end so it is
+               ;; appropriate to provide as much back-ends as possible.
                (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 = \""
-                       (find (negate symbolic-link?)
-                             (find-files (assoc-ref inputs "libusb")
-                                         "^libusb-.*\\.so\\..*"))
-                       "\""))))))))
-
+                   (let ((libusb0 (find
+                                    (negate symbolic-link?)
+                                    (find-files (assoc-ref inputs "libusb-compat")
+                                                "^libusb-.*\\.so\\..*")))
+                         (libusb1 (find
+                                    (negate symbolic-link?)
+                                    (find-files (assoc-ref inputs "libusb")
+                                                "^libusb-.*\\.so\\..*"))))
+                     (substitute* "usb/libloader.py"
+                       (("lib = locate_library\\(candidates, find_library\\)")
+                        "lib = candidates"))
+                     (substitute* "usb/backend/libusb0.py"
+                       (("\\('usb-0\\.1', 'usb', 'libusb0'\\)")
+                        (format #f "~s" libusb0)))
+                     (substitute* "usb/backend/libusb1.py"
+                       (("\\('usb-1\\.0', 'libusb-1\\.0', 'usb'\\)")
+                        (format #f "~s" libusb1)))
+                     ;; FIXME: OpenUSB is not packaged for GNU Guix.
+                     (substitute* "usb/backend/openusb.py"
+                       (("\\('openusb',\\)") "None")))))
+               ;; Note: tests seems to succeed with libusb-compat as libusb
+               ;; fails because it doesn't have a usbfs present in the build
+               ;; environment.
+               (replace 'check
+                 (lambda* (#:key tests? #:allow-other-keys)
+                   (when tests?
+                     (with-directory-excursion "tests"
+                       (setenv "PYUSB_DEBUG" "debug")
+                       (setenv "LIBUSB_DEBUG" "4")
+                       (invoke "python" "testall.py"))))))))
     (native-inputs
      (list python-setuptools-scm))
     (inputs
-     (list libusb))
+     (list libusb libusb-compat))
     (home-page "https://pyusb.github.io/pyusb/")
     (synopsis "Python bindings to the libusb library")
     (description
-- 
2.34.1





Information forwarded to guix-patches <at> gnu.org:
bug#65911; Package guix-patches. (Wed, 13 Sep 2023 09:57:03 GMT) Full text and rfc822 format available.

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

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 65911 <at> debbugs.gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH 4/4] gnu: Add liquidctl.
Date: Wed, 13 Sep 2023 11:55:59 +0200
* gnu/packages/hardware.scm (liquidctl): New variable.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
---
 gnu/packages/hardware.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index 5188bb2910..3d8fa833a2 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -16,6 +16,7 @@
 ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;; Copyright © 2022 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2023 Spencer Skylar Chan <schan12 <at> umd.edu>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello <at> foundationdevices.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -80,6 +81,7 @@ (define-module (gnu packages hardware)
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-crypto)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
@@ -99,6 +101,7 @@ (define-module (gnu packages hardware)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system perl)
+  #:use-module (guix build-system pyproject)
   #:use-module (guix build-system python)
   #:use-module (guix download)
   #:use-module (guix gexp)
@@ -798,6 +801,42 @@ (define-public libsmbios
     (license
      (list license:osl2.1 license:gpl2+ license:bsd-3 license:boost1.0))))
 
+(define-public liquidctl
+  (package
+    (name "liquidctl")
+    (version "1.13.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/liquidctl/liquidctl")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0hpxkrfxm9c4v5ld7bh6qs9fmq9imz8s5i9l0l78l47bcm12nkrd"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list #:phases
+           #~(modify-phases %standard-phases
+               (add-before 'check 'set-runtime-dir
+                 (lambda _
+                   (setenv "XDG_RUNTIME_DIR" "/tmp"))))))
+    (native-inputs (list python-pytest))
+    (propagated-inputs
+     (list python-colorlog
+           python-crcmod
+           python-docopt
+           python-hidapi
+           python-pillow
+           python-pyusb
+           python-smbus))
+    (home-page "https://github.com/liquidctl/liquidctl")
+    (synopsis "Drivers and tools for liquid cooling equipment")
+    (description "Liquidctl is a package with tools, drivers and a Python
+library to work with liquid cooling equipment such as @acronym{AIO, All-In-One}
+coolers, fan controllers and other devices.")
+    (license license:gpl3+)))
+
 ;; Distinct from memtest86, which is obsolete.
 (define-public memtest86+
   (package
-- 
2.34.1





Information forwarded to guix-patches <at> gnu.org:
bug#65911; Package guix-patches. (Wed, 13 Sep 2023 11:02:02 GMT) Full text and rfc822 format available.

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

From: Bruno Victal <mirai <at> makinata.eu>
To: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Cc: 65911 <at> debbugs.gnu.org
Subject: Re: [bug#65911] [PATCH 1/4] gnu: Add python-smbus.
Date: Wed, 13 Sep 2023 12:01:17 +0100
Hi Jean-Pierre,

On 2023-09-13 10:55, Jean-Pierre De Jesus DIAZ via Guix-patches via wrote:
> +               (add-after 'change-directory 'set-library-path
> +                 (lambda _
> +                   (substitute* "setup.py"
> +                     (("-L\\.\\./lib")
> +                      (string-append "-L" #$i2c-tools "/lib"))))))))

Rather than
	#$i2c-tools
do
	#$(this-package-input "i2c-tools"

-- 
Furthermore, I consider that nonfree software must be eradicated.

Cheers,
Bruno.





Information forwarded to guix-patches <at> gnu.org:
bug#65911; Package guix-patches. (Wed, 20 Sep 2023 10:06:02 GMT) Full text and rfc822 format available.

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

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 65911 <at> debbugs.gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH v1 2/4] gnu: python-pyusb: Use G-Expressions.
Date: Wed, 20 Sep 2023 12:05:26 +0200
* gnu/packages/usb.scm (python-pyusb) <arguments>: Use G-Expressions
  style instead of quoting.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
---
 gnu/packages/libusb.scm | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index e615b81ea3..469882e871 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -288,24 +288,23 @@ (define-public python-pyusb
          "1fg7knfzybzija2b01pzrzhzsj989scl12sb2ra4f503l8279k54"))))
     (build-system python-build-system)
     (arguments
-     `(#:tests? #f                      ; no tests
-       #:modules ((srfi srfi-1)
-                  (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 = \""
-                 (find (negate symbolic-link?)
-                       (find-files (assoc-ref inputs "libusb")
-                                   "^libusb-.*\\.so\\..*"))
-                 "\"")))
-             #t)))))
+     (list #:tests? #f                      ; no tests
+           #:modules '((srfi srfi-1)
+                       (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 = \""
+                       (find (negate symbolic-link?)
+                             (find-files (assoc-ref inputs "libusb")
+                                         "^libusb-.*\\.so\\..*"))
+                       "\""))))))))
 
     (native-inputs
      (list python-setuptools-scm))
-- 
2.34.1





Information forwarded to guix-patches <at> gnu.org:
bug#65911; Package guix-patches. (Wed, 20 Sep 2023 10:06:02 GMT) Full text and rfc822 format available.

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

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 65911 <at> debbugs.gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH v1 1/4] gnu: Add python-smbus.
Date: Wed, 20 Sep 2023 12:05:25 +0200
* gnu/packages/linux.scm (python-smbus): New variable.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
---
 gnu/packages/linux.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 85e3d9845d..6eb7fb43b8 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -75,6 +75,7 @@
 ;;; Copyright © 2023 Yovan Naumovski <yovan <at> gorski.stream>
 ;;; Copyright © 2023 Zheng Junjie <873216071 <at> qq.com>
 ;;; Copyright © 2023 dan <i <at> dan.games>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello <at> foundationdevices.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -188,6 +189,7 @@ (define-module (gnu packages linux)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
   #:use-module (guix build-system meson)
+  #:use-module (guix build-system pyproject)
   #:use-module (guix build-system python)
   #:use-module (guix build-system trivial)
   #:use-module (guix build-system linux-module)
@@ -4963,6 +4965,29 @@ (define-public i2c-tools-3
         #~(list (string-append "prefix=" #$output)
                 (string-append "CC=" #$(cc-for-target))))))))
 
+(define-public python-smbus
+  (package
+    (inherit i2c-tools)
+    (name "python-smbus")
+    (build-system pyproject-build-system)
+    (arguments
+     (list #:tests? #f ;; No test suite.
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'change-directory
+                 (lambda _ (chdir "py-smbus")))
+               (add-after 'change-directory 'set-library-path
+                 (lambda _
+                   (substitute* "setup.py"
+                     (("-L\\.\\./lib")
+                      (string-append "-L" #$(this-package-input "i2c-tools")
+                                     "/lib"))))))))
+    (inputs (list i2c-tools))
+    (synopsis "I2C/SMBus access for Python")
+    (description "This package provides a Python library to access
+@acronym{I2C, Inter-Integrated Circuit} and @acronym{SMBus, System
+Management Bus} devices on Linux.")))
+
 (define-public xsensors
   (package
     (name "xsensors")

base-commit: 6bd17a0806ad32d1493ac51a7443276f719c4224
-- 
2.34.1





Information forwarded to guix-patches <at> gnu.org:
bug#65911; Package guix-patches. (Wed, 20 Sep 2023 10:06:02 GMT) Full text and rfc822 format available.

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

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 65911 <at> debbugs.gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH v1 3/4] gnu: python-pyusb: Add libusb-compat backend.
Date: Wed, 20 Sep 2023 12:05:27 +0200
* gnu/packages/libusb.scm (python-pyusb) <arguments>: Do not hard-code
  libusb1 library for all back-ends, and allow to use libusb0 as a
  back-end.  Also enabled tests as the package does have a test suite.

* gnu/packages/libusb.scm (python-pyusb) <inputs>: Add libusb-compat.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
---
 gnu/packages/libusb.scm | 52 +++++++++++++++++++++++++++++++----------
 1 file changed, 40 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index 469882e871..d15e561668 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -288,28 +288,56 @@ (define-public python-pyusb
          "1fg7knfzybzija2b01pzrzhzsj989scl12sb2ra4f503l8279k54"))))
     (build-system python-build-system)
     (arguments
-     (list #:tests? #f                      ; no tests
-           #:modules '((srfi srfi-1)
+     (list #:modules '((srfi srfi-1)
                        (srfi srfi-26)
                        (guix build utils)
                        (guix build python-build-system))
            #:phases
            #~(modify-phases %standard-phases
+               ;; Repurpose the candidates parameter to be the path to the
+               ;; library, then on each backend we substitute the candidates
+               ;; with the full path to the .so library or with None if not
+               ;; supported.
+               ;;
+               ;; While most applications could use a single back-end this
+               ;; library allows to manually select the back-end so it is
+               ;; appropriate to provide as much back-ends as possible.
                (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 = \""
-                       (find (negate symbolic-link?)
-                             (find-files (assoc-ref inputs "libusb")
-                                         "^libusb-.*\\.so\\..*"))
-                       "\""))))))))
-
+                   (let ((libusb0 (find
+                                    (negate symbolic-link?)
+                                    (find-files (assoc-ref inputs "libusb-compat")
+                                                "^libusb-.*\\.so\\..*")))
+                         (libusb1 (find
+                                    (negate symbolic-link?)
+                                    (find-files (assoc-ref inputs "libusb")
+                                                "^libusb-.*\\.so\\..*"))))
+                     (substitute* "usb/libloader.py"
+                       (("lib = locate_library\\(candidates, find_library\\)")
+                        "lib = candidates"))
+                     (substitute* "usb/backend/libusb0.py"
+                       (("\\('usb-0\\.1', 'usb', 'libusb0'\\)")
+                        (format #f "~s" libusb0)))
+                     (substitute* "usb/backend/libusb1.py"
+                       (("\\('usb-1\\.0', 'libusb-1\\.0', 'usb'\\)")
+                        (format #f "~s" libusb1)))
+                     ;; FIXME: OpenUSB is not packaged for GNU Guix.
+                     (substitute* "usb/backend/openusb.py"
+                       (("\\('openusb',\\)") "None")))))
+               ;; Note: tests seems to succeed with libusb-compat as libusb
+               ;; fails because it doesn't have a usbfs present in the build
+               ;; environment.
+               (replace 'check
+                 (lambda* (#:key tests? #:allow-other-keys)
+                   (when tests?
+                     (with-directory-excursion "tests"
+                       (setenv "PYUSB_DEBUG" "debug")
+                       (setenv "LIBUSB_DEBUG" "4")
+                       (invoke "python" "testall.py"))))))))
     (native-inputs
      (list python-setuptools-scm))
     (inputs
-     (list libusb))
+     (list libusb libusb-compat))
     (home-page "https://pyusb.github.io/pyusb/")
     (synopsis "Python bindings to the libusb library")
     (description
-- 
2.34.1





Information forwarded to guix-patches <at> gnu.org:
bug#65911; Package guix-patches. (Wed, 20 Sep 2023 10:06:03 GMT) Full text and rfc822 format available.

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

From: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
To: 65911 <at> debbugs.gnu.org
Cc: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Subject: [PATCH v1 4/4] gnu: Add liquidctl.
Date: Wed, 20 Sep 2023 12:05:28 +0200
* gnu/packages/hardware.scm (liquidctl): New variable.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
---
 gnu/packages/hardware.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index 5188bb2910..3d8fa833a2 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -16,6 +16,7 @@
 ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;; Copyright © 2022 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2023 Spencer Skylar Chan <schan12 <at> umd.edu>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello <at> foundationdevices.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -80,6 +81,7 @@ (define-module (gnu packages hardware)
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-crypto)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
@@ -99,6 +101,7 @@ (define-module (gnu packages hardware)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system perl)
+  #:use-module (guix build-system pyproject)
   #:use-module (guix build-system python)
   #:use-module (guix download)
   #:use-module (guix gexp)
@@ -798,6 +801,42 @@ (define-public libsmbios
     (license
      (list license:osl2.1 license:gpl2+ license:bsd-3 license:boost1.0))))
 
+(define-public liquidctl
+  (package
+    (name "liquidctl")
+    (version "1.13.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/liquidctl/liquidctl")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0hpxkrfxm9c4v5ld7bh6qs9fmq9imz8s5i9l0l78l47bcm12nkrd"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list #:phases
+           #~(modify-phases %standard-phases
+               (add-before 'check 'set-runtime-dir
+                 (lambda _
+                   (setenv "XDG_RUNTIME_DIR" "/tmp"))))))
+    (native-inputs (list python-pytest))
+    (propagated-inputs
+     (list python-colorlog
+           python-crcmod
+           python-docopt
+           python-hidapi
+           python-pillow
+           python-pyusb
+           python-smbus))
+    (home-page "https://github.com/liquidctl/liquidctl")
+    (synopsis "Drivers and tools for liquid cooling equipment")
+    (description "Liquidctl is a package with tools, drivers and a Python
+library to work with liquid cooling equipment such as @acronym{AIO, All-In-One}
+coolers, fan controllers and other devices.")
+    (license license:gpl3+)))
+
 ;; Distinct from memtest86, which is obsolete.
 (define-public memtest86+
   (package
-- 
2.34.1





Information forwarded to guix-patches <at> gnu.org:
bug#65911; Package guix-patches. (Wed, 20 Sep 2023 10:08:01 GMT) Full text and rfc822 format available.

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

From: Jean-Pierre De Jesus Diaz <jean <at> foundationdevices.com>
To: Bruno Victal <mirai <at> makinata.eu>
Cc: 65911 <at> debbugs.gnu.org
Subject: Re: [bug#65911] [PATCH 1/4] gnu: Add python-smbus.
Date: Wed, 20 Sep 2023 12:07:25 +0200
Hi Bruno,

>Rather than
>        #$i2c-tools
>do
>         #$(this-package-input "i2c-tools"

Sent updated patches fixing this issue.

Thanks for pointing it out.

Cheers,


On Wed, Sep 13, 2023 at 1:01 PM Bruno Victal <mirai <at> makinata.eu> wrote:
>
> Hi Jean-Pierre,
>
> On 2023-09-13 10:55, Jean-Pierre De Jesus DIAZ via Guix-patches via wrote:
> > +               (add-after 'change-directory 'set-library-path
> > +                 (lambda _
> > +                   (substitute* "setup.py"
> > +                     (("-L\\.\\./lib")
> > +                      (string-append "-L" #$i2c-tools "/lib"))))))))
>
> Rather than
>         #$i2c-tools
> do
>         #$(this-package-input "i2c-tools"
>
> --
> Furthermore, I consider that nonfree software must be eradicated.
>
> Cheers,
> Bruno.
>


-- 
—
Jean-Pierre De Jesus DIAZ
Software Engineer
Foundation Devices




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Wed, 27 Sep 2023 22:09:01 GMT) Full text and rfc822 format available.

Notification sent to Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>:
bug acknowledged by developer. (Wed, 27 Sep 2023 22:09:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>
Cc: 65911-done <at> debbugs.gnu.org
Subject: Re: bug#65911: [PATCH 0/4] gnu: Add liquidctl.
Date: Thu, 28 Sep 2023 00:08:08 +0200
Hi,

Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com> skribis:

> * gnu/packages/hardware.scm (liquidctl): New variable.
>
> Signed-off-by: Jean-Pierre De Jesus DIAZ <jean <at> foundationdevices.com>

Applied the whole series, thank you!

Ludo’.

PS: Please avoid ‘Signed-off-by’ in commit messages: we keep this tag
    for the person who commits on your behalf.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 26 Oct 2023 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 196 days ago.

Previous Next


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