diff mbox series

[bug#60840,2/3] gnu: packages: Add python-pulsectl.

Message ID 87h6wr8lah.fsf@colimite.fr
State New
Headers show
Series [bug#60840,1/3] gnu: volctl: Make the synopsis line shorter. | expand

Commit Message

Sergiu Ivanov Jan. 15, 2023, 10:49 p.m. UTC

Comments

Maxim Cournoyer Jan. 16, 2023, 5:01 p.m. UTC | #1
Hello,

Sergiu Ivanov <sivanov@colimite.fr> writes:

>>From b92cdb4ce99bc7ad45e0caba7f863db5931741db Mon Sep 17 00:00:00 2001
> From: Sergiu Ivanov <sivanov@colimite.fr>
> Date: Sun, 15 Jan 2023 23:16:02 +0100
> Subject: [PATCH 2/3] gnu: packages: Add python-pulsectl.
>
> * gnu/packages/audio.scm (python-pulsectl): New variable.

Thanks for this contribution!

> ---
>  gnu/packages/audio.scm | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
>
> diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
> index d72cf0ca87..391a763e45 100644
> --- a/gnu/packages/audio.scm
> +++ b/gnu/packages/audio.scm
> @@ -40,6 +40,7 @@
>  ;;; Copyright © 2022 Juliana Sims <jtsims@protonmail.com>
>  ;;; Copyright © 2022 Simon Streit <simon@netpanic.org>
>  ;;; Copyright © 2022 Andy Tai <atai@atai.org>
> +;;; Copyright © 2023 Sergiu Ivanov <sivanov@colimite.fr>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -2779,6 +2780,39 @@ (define-public python-pyaudio
>  cross-platform audio input/output stream library.")
>      (license license:expat)))
>  
> +(define-public python-pulsectl
> +  (package
> +    (name "python-pulsectl")
> +    (version "22.3.2")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (pypi-uri "pulsectl" version))
> +              (sha256
> +               (base32
> +                "115ha1cwpd2r84ssnxdbr59hgs0jbx0lz3xpqli64kmxxqf4w5yc"))))
> +    (build-system python-build-system)
> +    (inputs (list pulseaudio))
> +    (arguments
> +     `(#:tests? #f

Tests are typically stripped from the pypi source archive (sdist).  If
you look into the source repository, there are tests under
pulsectl/tests, so it'd be better to fetch the source from git.

Also note that for the cases where using #:tests? #f is actually needed
(when there really are no test suite), a short explanatory comment is
expected (;no test suite).

> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-after 'unpack 'patch-path
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (let ((pulse (assoc-ref inputs "pulseaudio")))
> +               (substitute* "pulsectl/_pulsectl.py"
> +                 (("libpulse.so.0")
> +                  (string-append pulse "/lib/libpulse.so.0")))
> +               #t))))))

Please do not include trailing #t in phases or snippets anymore; they
are not needed.  Also prefer using a plain list for arguments and
g-expressions (gexps).

> +    (home-page "https://github.com/mk-fg/python-pulse-control")
> +    (synopsis
> +     "Python bindings for mixer-like controls in PulseAudio")
> +    (description
> +     "Python high-level interface and ctypes-based bindings for
> +PulseAudio (libpulse), to use in simple synchronous code.  This wrapper is
> +mostly for mixer-like controls and introspection-related operations, as
> +opposed to e.g. submitting sound samples to play and player-like
> client.")

I'd start the description with "This package provides a Python
high-level interface [...]", to make it a complete sentence.

I'd use plural for the last word (player-like clientS), as there could
be more than one client available.

Don't forget to CC my email when sending a revised v2 version with the
above :-).
Maxim Cournoyer Jan. 16, 2023, 5:06 p.m. UTC | #2
Hi again,

Sergiu Ivanov <sivanov@colimite.fr> writes:

>>From b92cdb4ce99bc7ad45e0caba7f863db5931741db Mon Sep 17 00:00:00 2001
> From: Sergiu Ivanov <sivanov@colimite.fr>
> Date: Sun, 15 Jan 2023 23:16:02 +0100
> Subject: [PATCH 2/3] gnu: packages: Add python-pulsectl.

[...]

> +(define-public python-pulsectl
> +  (package
> +    (name "python-pulsectl")
> +    (version "22.3.2")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (pypi-uri "pulsectl" version))
> +              (sha256
> +               (base32
> +                "115ha1cwpd2r84ssnxdbr59hgs0jbx0lz3xpqli64kmxxqf4w5yc"))))
> +    (build-system python-build-system)
> +    (inputs (list pulseaudio))
> +    (arguments
> +     `(#:tests? #f
> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-after 'unpack 'patch-path
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (let ((pulse (assoc-ref inputs "pulseaudio")))
> +               (substitute* "pulsectl/_pulsectl.py"
> +                 (("libpulse.so.0")
> +                  (string-append pulse "/lib/libpulse.so.0")))

Sorry, I forgot to mention in my previous reply: here, you could use
(search-input-file inputs "lib/libpulse.so.0"), which has the added
benefit of failing if the file cannot be found in the inputs arguments.
Maxim Cournoyer Jan. 22, 2023, 9:28 p.m. UTC | #3
Hello,

Sergiu Ivanov <sergiu.ivanov@univ-evry.fr> writes:

> Hi again,
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> [2023-01-16T18:01:59+0100]:
>>
>> Don't forget to CC my email when sending a revised v2 version with the
>> above :-).
>
> I CCed you, but Google doesn't like another quirk in my E-mail
> configuration which I don't have motivation to debug :-S
>
> I therefore sending you a small ping from my work E-mail, and I'm
> attaching the 3 updated patches just in case it is more convenient
> for you.

Thanks!  I've made cosmetic adjustments to the update commit like so:

--8<---------------cut here---------------start------------->8---
modified   gnu/packages/gtk.scm
@@ -2968,12 +2968,17 @@ (define-public volctl
            (lambda* (#:key inputs #:allow-other-keys)
              (substitute* "volctl/xwrappers.py"
                (("libXfixes.so")
-                (string-append (search-input-file inputs "/lib/libXfixes.so")))))))))
+                (string-append (search-input-file inputs
+                                                  "/lib/libXfixes.so")))))))))
     (inputs
      (list libxfixes))
     (propagated-inputs
-     (list python-click python-pycairo python-pygobject python-pyyaml
-           python-pulsectl gtk+))
+     (list python-click
+           python-pycairo
+           python-pygobject
+           python-pyyaml
+           python-pulsectl
+           gtk+))
     (home-page "https://buzz.github.io/volctl/")
     (synopsis "Per-application volume control and on-screen display")
     (description "Volctl is a PulseAudio-enabled tray icon volume control and
--8<---------------cut here---------------end--------------->8---

added a proper GNU Change Log to the commit message:

--8<---------------cut here---------------start------------->8---
gnu: volctl: Update to 0.9.3.

Fixes <https://issues.guix.gnu.org/58120>.

* gnu/packages/gtk.scm (volctl): Update to 0.9.3.
[arguments]: Update substitutions in patch-path phase and delete
trailing #t.
[inputs]: Delete pulseaudio.  Move gtk+ to...
[propagated-inputs] ... here.
--8<---------------cut here---------------end--------------->8---

and pushed the series!

Notice that in my environment, it doesn't run:

--8<---------------cut here---------------start------------->8---
$ volctl
PulseAudio connected
Warning: Could not embed Gtk.StatusIcon.
Fatal error: Could not create a status icon. Are you sure you have a working notification area?
pulseaudio disconnected
Alarm clock
--8<---------------cut here---------------end--------------->8---

although I have 'dunst' running on top of my ratpoison WM.
Sergiu Ivanov Jan. 23, 2023, 5:38 p.m. UTC | #4
Hello,

Maxim Cournoyer <maxim.cournoyer@gmail.com> [2023-01-22T22:28:06+0100]:
[...]
>> I CCed you, but Google doesn't like another quirk in my E-mail
>> configuration which I don't have motivation to debug :-S
>>
>> I therefore sending you a small ping from my work E-mail, and I'm
>> attaching the 3 updated patches just in case it is more convenient
>> for you.
>
> Thanks!  I've made cosmetic adjustments to the update commit like so:
[...]

Thank you!

> added a proper GNU Change Log to the commit message:
>
> gnu: volctl: Update to 0.9.3.
>
> Fixes <https://issues.guix.gnu.org/58120>.

Ah!  Incidentally, this is what I was aiming to fix when I started the
work on this patch series, but guix lint told me I could update the
version… :D

> * gnu/packages/gtk.scm (volctl): Update to 0.9.3.
> [arguments]: Update substitutions in patch-path phase and delete
> trailing #t.
> [inputs]: Delete pulseaudio.  Move gtk+ to...
> [propagated-inputs] ... here.
>
>
> and pushed the series!

Cool!

> Notice that in my environment, it doesn't run:
>
> $ volctl
> PulseAudio connected
> Warning: Could not embed Gtk.StatusIcon.
> Fatal error: Could not create a status icon. Are you sure you have a working notification area?
> pulseaudio disconnected
> Alarm clock
>
> although I have 'dunst' running on top of my ratpoison WM.

I tested the new version with ./pre-inst-env guix shell volctl and
everything looked fine with the default systray of EXWM.

I will do a global system update by the end of the week and will see if
I can reproduce and fix the issue.

-
Sergiu
diff mbox series

Patch

From b92cdb4ce99bc7ad45e0caba7f863db5931741db Mon Sep 17 00:00:00 2001
From: Sergiu Ivanov <sivanov@colimite.fr>
Date: Sun, 15 Jan 2023 23:16:02 +0100
Subject: [PATCH 2/3] gnu: packages: Add python-pulsectl.

* gnu/packages/audio.scm (python-pulsectl): New variable.
---
 gnu/packages/audio.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index d72cf0ca87..391a763e45 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -40,6 +40,7 @@ 
 ;;; Copyright © 2022 Juliana Sims <jtsims@protonmail.com>
 ;;; Copyright © 2022 Simon Streit <simon@netpanic.org>
 ;;; Copyright © 2022 Andy Tai <atai@atai.org>
+;;; Copyright © 2023 Sergiu Ivanov <sivanov@colimite.fr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2779,6 +2780,39 @@  (define-public python-pyaudio
 cross-platform audio input/output stream library.")
     (license license:expat)))
 
+(define-public python-pulsectl
+  (package
+    (name "python-pulsectl")
+    (version "22.3.2")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "pulsectl" version))
+              (sha256
+               (base32
+                "115ha1cwpd2r84ssnxdbr59hgs0jbx0lz3xpqli64kmxxqf4w5yc"))))
+    (build-system python-build-system)
+    (inputs (list pulseaudio))
+    (arguments
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-path
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((pulse (assoc-ref inputs "pulseaudio")))
+               (substitute* "pulsectl/_pulsectl.py"
+                 (("libpulse.so.0")
+                  (string-append pulse "/lib/libpulse.so.0")))
+               #t))))))
+    (home-page "https://github.com/mk-fg/python-pulse-control")
+    (synopsis
+     "Python bindings for mixer-like controls in PulseAudio")
+    (description
+     "Python high-level interface and ctypes-based bindings for
+PulseAudio (libpulse), to use in simple synchronous code.  This wrapper is
+mostly for mixer-like controls and introspection-related operations, as
+opposed to e.g. submitting sound samples to play and player-like client.")
+    (license license:expat)))
+
 (define-public python-pyliblo
   (package
     (name "python-pyliblo")
-- 
2.38.1