Subject: [PATCH 16/92] gnu: qtile: Update to 0.23.0.

From: Nicolas Graves <[email-masked]>
Date: Fri, 10 May 2024 00:53:11 +0200

* gnu/packages/wm.scm (qtile): Update to 0.23.0.
  [build-system]: Upgrade to pyproject-build-system.
  [arguments]<#:phases>: Use gexp (but do not indent). Add phase
  pre-check.
  <#:test-flags>: Use it.
  [native-inputs]: Add python-pytest and
  xorg-server-for-tests. Reorder.

Change-Id: Id6f291c0d23fa2cef17d6e45552f45c56f162741
---
 gnu/packages/wm.scm | 35 ++++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index f2cb77f5bfd..3ae4d03839b 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -63,7 +63,7 @@
 ;;; Copyright © 2023 Gabriel Wicki <[email-masked]>
 ;;; Copyright © 2023 Jonathan Brielamier <[email-masked]>
 ;;; Copyright © 2023 Vessel Wave <[email-masked]>
-;;; Copyright © 2023 Nicolas Graves <[email-masked]>
+;;; Copyright © 2023, 2024 Nicolas Graves <[email-masked]>
 ;;; Copyright © 2023, 2024 Jaeme Sifat <[email-masked]>
 ;;; Copyright © 2023 Josselin Poiret <[email-masked]>
 ;;; Copyright © 2024 Timotej Lazar <[email-masked]>
@@ -101,6 +101,7 @@ (define-module (gnu packages wm)
   #:use-module (guix build-system haskell)
   #: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 build-system trivial)
   #:use-module (guix utils)
@@ -594,19 +595,22 @@ (define-public python-i3-py
 (define-public qtile
   (package
     (name "qtile")
-    (version "0.18.1")
+    (version "0.23.0")
     (source
       (origin
         (method url-fetch)
         (uri (pypi-uri "qtile" version))
         (sha256
-          (base32 "14hb26xkza7brvkd4276j60mxd3zsas72ih6y0cq3j060izm1865"))))
-    (build-system python-build-system)
+          (base32 "1v8rxm2xg2igxv6gwa78wrkxzgfxmxfgflbjdp4fm7cxjdx3zrpa"))))
+    (build-system pyproject-build-system)
     (arguments
-     `(#:tests? #f ; Tests require Xvfb and writable temp/cache space
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'patch-paths
+     (list
+      ;; A lot of tests fail despite Xvfb and writable temp/cache space.
+      #:tests? #f
+      #:test-flags '("--ignore=test/widgets/test_widget_init_configure.py")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-paths
            (lambda* (#:key inputs #:allow-other-keys)
              (substitute* "libqtile/pangocffi.py"
                (("^gobject = ffi.dlopen.*")
@@ -626,7 +630,14 @@ (define-public qtile
                (mkdir-p xsessions)
                (copy-file "resources/qtile.desktop" (string-append xsessions "/qtile.desktop"))
                (substitute* (string-append xsessions "/qtile.desktop")
-                 (("qtile start") qtile))))))))
+                 (("qtile start") qtile)))))
+          (add-before 'check 'pre-check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (setenv "HOME" "/tmp")
+                (system "Xvfb :1 &")
+                (setenv "DISPLAY" ":1")
+                (setenv "XDG_CACHE_HOME" "/tmp")))))))
     (inputs
       (list glib pango pulseaudio))
     (propagated-inputs
@@ -643,9 +654,11 @@ (define-public qtile
       (list pkg-config
             python-flake8
             python-pep8-naming
-            python-psutil
+            python-pytest
             python-pytest-cov
-            python-setuptools-scm))
+            python-psutil
+            python-setuptools-scm
+            xorg-server-for-tests))
     (home-page "http://qtile.org")
     (synopsis "Hackable tiling window manager written and configured in Python")
     (description "Qtile is simple, small, and extensible.  It's easy to write
-- 
2.41.0