unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#65911] [PATCH 0/4] gnu: Add liquidctl.
@ 2023-09-13  9:53 Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-13  9:55 ` [bug#65911] [PATCH 1/4] gnu: Add python-smbus Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-20 10:05 ` [bug#65911] [PATCH v1 " Jean-Pierre De Jesus DIAZ via Guix-patches via
  0 siblings, 2 replies; 12+ messages in thread
From: Jean-Pierre De Jesus DIAZ via Guix-patches via @ 2023-09-13  9:53 UTC (permalink / raw)
  To: 65911; +Cc: Jean-Pierre De Jesus DIAZ

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





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

* [bug#65911] [PATCH 1/4] gnu: Add python-smbus.
  2023-09-13  9:53 [bug#65911] [PATCH 0/4] gnu: Add liquidctl Jean-Pierre De Jesus DIAZ via Guix-patches via
@ 2023-09-13  9:55 ` Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-13  9:55   ` [bug#65911] [PATCH 2/4] gnu: python-pyusb: Use G-Expressions Jean-Pierre De Jesus DIAZ via Guix-patches via
                     ` (3 more replies)
  2023-09-20 10:05 ` [bug#65911] [PATCH v1 " Jean-Pierre De Jesus DIAZ via Guix-patches via
  1 sibling, 4 replies; 12+ messages in thread
From: Jean-Pierre De Jesus DIAZ via Guix-patches via @ 2023-09-13  9:55 UTC (permalink / raw)
  To: 65911; +Cc: Jean-Pierre De Jesus DIAZ

* gnu/packages/linux.scm (python-smbus): New variable.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean@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@gorski.stream>
 ;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
 ;;; Copyright © 2023 dan <i@dan.games>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@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





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

* [bug#65911] [PATCH 2/4] gnu: python-pyusb: Use G-Expressions.
  2023-09-13  9:55 ` [bug#65911] [PATCH 1/4] gnu: Add python-smbus Jean-Pierre De Jesus DIAZ via Guix-patches via
@ 2023-09-13  9:55   ` Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-13  9:55   ` [bug#65911] [PATCH 3/4] gnu: python-pyusb: Add libusb-compat backend Jean-Pierre De Jesus DIAZ via Guix-patches via
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Jean-Pierre De Jesus DIAZ via Guix-patches via @ 2023-09-13  9:55 UTC (permalink / raw)
  To: 65911; +Cc: Jean-Pierre De Jesus DIAZ

* gnu/packages/usb.scm (python-pyusb) <arguments>: Use G-Expressions
  style instead of quoting.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean@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





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

* [bug#65911] [PATCH 3/4] gnu: python-pyusb: Add libusb-compat backend.
  2023-09-13  9:55 ` [bug#65911] [PATCH 1/4] gnu: Add python-smbus Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-13  9:55   ` [bug#65911] [PATCH 2/4] gnu: python-pyusb: Use G-Expressions Jean-Pierre De Jesus DIAZ via Guix-patches via
@ 2023-09-13  9:55   ` Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-13  9:55   ` [bug#65911] [PATCH 4/4] gnu: Add liquidctl Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-13 11:01   ` [bug#65911] [PATCH 1/4] gnu: Add python-smbus Bruno Victal
  3 siblings, 0 replies; 12+ messages in thread
From: Jean-Pierre De Jesus DIAZ via Guix-patches via @ 2023-09-13  9:55 UTC (permalink / raw)
  To: 65911; +Cc: Jean-Pierre De Jesus DIAZ

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





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

* [bug#65911] [PATCH 4/4] gnu: Add liquidctl.
  2023-09-13  9:55 ` [bug#65911] [PATCH 1/4] gnu: Add python-smbus Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-13  9:55   ` [bug#65911] [PATCH 2/4] gnu: python-pyusb: Use G-Expressions Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-13  9:55   ` [bug#65911] [PATCH 3/4] gnu: python-pyusb: Add libusb-compat backend Jean-Pierre De Jesus DIAZ via Guix-patches via
@ 2023-09-13  9:55   ` Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-13 11:01   ` [bug#65911] [PATCH 1/4] gnu: Add python-smbus Bruno Victal
  3 siblings, 0 replies; 12+ messages in thread
From: Jean-Pierre De Jesus DIAZ via Guix-patches via @ 2023-09-13  9:55 UTC (permalink / raw)
  To: 65911; +Cc: Jean-Pierre De Jesus DIAZ

* gnu/packages/hardware.scm (liquidctl): New variable.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean@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@gmail.com>
 ;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2023 Spencer Skylar Chan <schan12@umd.edu>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@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





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

* [bug#65911] [PATCH 1/4] gnu: Add python-smbus.
  2023-09-13  9:55 ` [bug#65911] [PATCH 1/4] gnu: Add python-smbus Jean-Pierre De Jesus DIAZ via Guix-patches via
                     ` (2 preceding siblings ...)
  2023-09-13  9:55   ` [bug#65911] [PATCH 4/4] gnu: Add liquidctl Jean-Pierre De Jesus DIAZ via Guix-patches via
@ 2023-09-13 11:01   ` Bruno Victal
  2023-09-20 10:07     ` Jean-Pierre De Jesus Diaz via Guix-patches via
  3 siblings, 1 reply; 12+ messages in thread
From: Bruno Victal @ 2023-09-13 11:01 UTC (permalink / raw)
  To: Jean-Pierre De Jesus DIAZ; +Cc: 65911

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.





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

* [bug#65911] [PATCH v1 1/4] gnu: Add python-smbus.
  2023-09-13  9:53 [bug#65911] [PATCH 0/4] gnu: Add liquidctl Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-13  9:55 ` [bug#65911] [PATCH 1/4] gnu: Add python-smbus Jean-Pierre De Jesus DIAZ via Guix-patches via
@ 2023-09-20 10:05 ` Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-20 10:05   ` [bug#65911] [PATCH v1 2/4] gnu: python-pyusb: Use G-Expressions Jean-Pierre De Jesus DIAZ via Guix-patches via
                     ` (2 more replies)
  1 sibling, 3 replies; 12+ messages in thread
From: Jean-Pierre De Jesus DIAZ via Guix-patches via @ 2023-09-20 10:05 UTC (permalink / raw)
  To: 65911; +Cc: Jean-Pierre De Jesus DIAZ

* gnu/packages/linux.scm (python-smbus): New variable.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean@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@gorski.stream>
 ;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
 ;;; Copyright © 2023 dan <i@dan.games>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@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





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

* [bug#65911] [PATCH v1 2/4] gnu: python-pyusb: Use G-Expressions.
  2023-09-20 10:05 ` [bug#65911] [PATCH v1 " Jean-Pierre De Jesus DIAZ via Guix-patches via
@ 2023-09-20 10:05   ` Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-20 10:05   ` [bug#65911] [PATCH v1 3/4] gnu: python-pyusb: Add libusb-compat backend Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-20 10:05   ` [bug#65911] [PATCH v1 4/4] gnu: Add liquidctl Jean-Pierre De Jesus DIAZ via Guix-patches via
  2 siblings, 0 replies; 12+ messages in thread
From: Jean-Pierre De Jesus DIAZ via Guix-patches via @ 2023-09-20 10:05 UTC (permalink / raw)
  To: 65911; +Cc: Jean-Pierre De Jesus DIAZ

* gnu/packages/usb.scm (python-pyusb) <arguments>: Use G-Expressions
  style instead of quoting.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean@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





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

* [bug#65911] [PATCH v1 3/4] gnu: python-pyusb: Add libusb-compat backend.
  2023-09-20 10:05 ` [bug#65911] [PATCH v1 " Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-20 10:05   ` [bug#65911] [PATCH v1 2/4] gnu: python-pyusb: Use G-Expressions Jean-Pierre De Jesus DIAZ via Guix-patches via
@ 2023-09-20 10:05   ` Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-20 10:05   ` [bug#65911] [PATCH v1 4/4] gnu: Add liquidctl Jean-Pierre De Jesus DIAZ via Guix-patches via
  2 siblings, 0 replies; 12+ messages in thread
From: Jean-Pierre De Jesus DIAZ via Guix-patches via @ 2023-09-20 10:05 UTC (permalink / raw)
  To: 65911; +Cc: Jean-Pierre De Jesus DIAZ

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





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

* [bug#65911] [PATCH v1 4/4] gnu: Add liquidctl.
  2023-09-20 10:05 ` [bug#65911] [PATCH v1 " Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-20 10:05   ` [bug#65911] [PATCH v1 2/4] gnu: python-pyusb: Use G-Expressions Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-20 10:05   ` [bug#65911] [PATCH v1 3/4] gnu: python-pyusb: Add libusb-compat backend Jean-Pierre De Jesus DIAZ via Guix-patches via
@ 2023-09-20 10:05   ` Jean-Pierre De Jesus DIAZ via Guix-patches via
  2023-09-27 22:08     ` bug#65911: [PATCH 0/4] " Ludovic Courtès
  2 siblings, 1 reply; 12+ messages in thread
From: Jean-Pierre De Jesus DIAZ via Guix-patches via @ 2023-09-20 10:05 UTC (permalink / raw)
  To: 65911; +Cc: Jean-Pierre De Jesus DIAZ

* gnu/packages/hardware.scm (liquidctl): New variable.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean@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@gmail.com>
 ;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2023 Spencer Skylar Chan <schan12@umd.edu>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@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





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

* [bug#65911] [PATCH 1/4] gnu: Add python-smbus.
  2023-09-13 11:01   ` [bug#65911] [PATCH 1/4] gnu: Add python-smbus Bruno Victal
@ 2023-09-20 10:07     ` Jean-Pierre De Jesus Diaz via Guix-patches via
  0 siblings, 0 replies; 12+ messages in thread
From: Jean-Pierre De Jesus Diaz via Guix-patches via @ 2023-09-20 10:07 UTC (permalink / raw)
  To: Bruno Victal; +Cc: 65911

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




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

* bug#65911: [PATCH 0/4] gnu: Add liquidctl.
  2023-09-20 10:05   ` [bug#65911] [PATCH v1 4/4] gnu: Add liquidctl Jean-Pierre De Jesus DIAZ via Guix-patches via
@ 2023-09-27 22:08     ` Ludovic Courtès
  0 siblings, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2023-09-27 22:08 UTC (permalink / raw)
  To: Jean-Pierre De Jesus DIAZ; +Cc: 65911-done

Hi,

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

> * gnu/packages/hardware.scm (liquidctl): New variable.
>
> Signed-off-by: Jean-Pierre De Jesus DIAZ <jean@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.




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

end of thread, other threads:[~2023-09-27 22:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-13  9:53 [bug#65911] [PATCH 0/4] gnu: Add liquidctl Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-09-13  9:55 ` [bug#65911] [PATCH 1/4] gnu: Add python-smbus Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-09-13  9:55   ` [bug#65911] [PATCH 2/4] gnu: python-pyusb: Use G-Expressions Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-09-13  9:55   ` [bug#65911] [PATCH 3/4] gnu: python-pyusb: Add libusb-compat backend Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-09-13  9:55   ` [bug#65911] [PATCH 4/4] gnu: Add liquidctl Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-09-13 11:01   ` [bug#65911] [PATCH 1/4] gnu: Add python-smbus Bruno Victal
2023-09-20 10:07     ` Jean-Pierre De Jesus Diaz via Guix-patches via
2023-09-20 10:05 ` [bug#65911] [PATCH v1 " Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-09-20 10:05   ` [bug#65911] [PATCH v1 2/4] gnu: python-pyusb: Use G-Expressions Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-09-20 10:05   ` [bug#65911] [PATCH v1 3/4] gnu: python-pyusb: Add libusb-compat backend Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-09-20 10:05   ` [bug#65911] [PATCH v1 4/4] gnu: Add liquidctl Jean-Pierre De Jesus DIAZ via Guix-patches via
2023-09-27 22:08     ` bug#65911: [PATCH 0/4] " 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).