Subject: [bug#77575] [PATCH 19/21] gnu: bpytop: Switch to pyproject-build-system.

From: Nicolas Graves <[email-masked]>
Date: Sun, 6 Apr 2025 14:37:21 +0200

* gnu/packages/admin.scm (bpytop)
[build-system]: Swith to pyproject.
[arguments]{tests?}: Disable tests.
{phases}: Add phase 'use-poetry-core. Improve phase 'install-theme.
[native-inputs]: Add python-poetry-core.
---
 gnu/packages/admin.scm | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 9aa71f8cf9..ce34477749 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -1065,25 +1065,29 @@ (define-public bpytop
        (uri (pypi-uri "bpytop" version))
        (sha256
         (base32 "1clvajbv7pzlya9s1xs6dvjic8rv3kx7aqiwnjxapiypx246gdjk"))))
-    (build-system python-build-system)
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:tests? #f ; No tests in Pypi archive.
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'use-poetry-core
+            (lambda _
+              ;; Patch to use the core poetry API.
+              (substitute* "pyproject.toml"
+                (("poetry.masonry.api")
+                 "poetry.core.masonry.api"))))
+          (add-after 'install 'install-themes
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              (let ((themes (string-append (site-packages inputs outputs)
+                                           "/bpytop-themes")))
+                (mkdir-p themes)
+                (copy-recursively "themes" themes)))))))
     (inputs
      (list python-psutil))
-    (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         ;; sanity-check phase fail, but the application seems to be working
-         (delete 'sanity-check)
-         (add-after 'install 'install-themes
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((themes (string-append (assoc-ref outputs "out")
-                                          "/lib/python"
-                                          ,(version-major+minor
-                                            (package-version python))
-                                          "/site-packages/bpytop-themes")))
-               (mkdir-p themes)
-               (copy-recursively "themes" themes)))))))
-    (home-page
-     "https://github.com/aristocratos/bpytop")
+    (native-inputs
+     (list python-poetry-core))
+    (home-page "https://github.com/aristocratos/bpytop")
     (synopsis "Resource monitor")
     (description "Resource monitor that shows usage and stats for processor,
 memory, disks, network and processes.  It's a Python port and continuation of
-- 
2.49.0