Subject: [bug#55516] [PATCH v2] gnu: Add quodlibet.

From: Remco van 't Veer <[email-masked]>
Date: Sat, 28 May 2022 10:57:18 +0200

* gnu/packages/music.scm (quodlibet): New variable.
---
 gnu/packages/music.scm | 94 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)

diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index b224a145d5..7db6c2a037 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -45,6 +45,7 @@
 ;;; Copyright © 2021 Xinglu Chen <[email-masked]>
 ;;; Copyright © 2021 Thomas Albers Raviola <[email-masked]>
 ;;; Copyright © 2022 Sughosha <[email-masked]>
+;;; Copyright © 2022 Remco van 't Veer <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -153,6 +154,7 @@ (define-module (gnu packages music)
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages pulseaudio) ;libsndfile
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-build)
   #:use-module (gnu packages python-check)
   #:use-module (gnu packages python-compression)
   #:use-module (gnu packages python-web)
@@ -6878,3 +6880,95 @@ (define-public musikcube
 streaming audio server.")
     (home-page "https://musikcube.com/")
     (license license:bsd-3)))
+
+(define-public quodlibet
+  (package
+    (name "quodlibet")
+    (version "4.5.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/quodlibet/quodlibet")
+             (commit (string-append "release-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1i5k93k3bfp7hpcwkbr865mbj9jam3jv2a5k1bazcyp4f5vdrb0v"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:modules ((guix build gnu-build-system)
+                  (guix build python-build-system)
+                  ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
+                  (guix build utils))
+       #:imported-modules (,@%gnu-build-system-modules
+                           (guix build python-build-system)
+                           (guix build glib-or-gtk-build-system))
+       #:tests? #t
+       #:phases
+       (modify-phases %standard-phases
+
+         (add-before 'check 'test-suite-wants-to-home-directory
+           (lambda _
+             (setenv "HOME" (getcwd))
+             #t))
+
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (if tests?
+                 (begin
+                   (invoke "xvfb-run" "pytest"
+                           "--disable-warnings" ; ignored upstream
+                           "--ignore=tests/test_browsers_iradio.py" ; needs network
+                           "--ignore=tests/quality" ; broken upstream
+                           ))
+                 (format #t "test suite not run~%"))))
+
+         (add-after 'install 'glib-or-gtk-wrap ; ensure icons loaded
+           (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))
+
+         (add-after 'install 'wrap-gi-typelib ; GObject Introspection
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out"))
+                   (gi-typelib-path (getenv "GI_TYPELIB_PATH")))
+               (for-each (lambda (prog)
+                           (wrap-program (string-append out "/bin/" prog)
+                             `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))))
+                         '("exfalso" "quodlibet")))
+             #t)))))
+
+    (native-inputs
+     (list xvfb-run gettext-minimal))
+    (inputs
+     (list adwaita-icon-theme
+           gtk+ ;; propagates gdk-pixbuf+svg
+           glib
+           gsettings-desktop-schemas
+           gst-plugins-bad
+           gst-plugins-base
+           gst-plugins-good
+           gst-plugins-ugly
+           gstreamer
+           gtk+
+           hicolor-icon-theme
+           librsvg
+           libsoup-minimal-2
+           python
+           python-cheetah
+           python-dbus
+           python-feedparser
+           python-gst
+           python-iniconfig
+           python-mutagen
+           python-pycairo
+           python-pygobject
+           python-pytest
+           python-sgmllib3k
+           python-toml))
+    (home-page "https://github.com/quodlibet/quodlibet")
+    (synopsis "Audio library, manager & player")
+    (description "Quod Libet is a cross-platform audio / music management
+program. It provides many ways to view your local library, and supports
+streaming audio and feeds (podcasts etc). It has extremely flexible metadata
+editing and searching capabilities. Ex Falso is a program that uses the same
+tag editing back-end as Quod Libet, but isn’t connected to an audio player.")
+    (license license:gpl2+)))
-- 
2.36.1