summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorTobias Kortkamp <tobias.kortkamp@gmail.com>2022-08-26 16:37:12 +0200
committerMathieu Othacehe <othacehe@gnu.org>2022-09-11 16:48:12 +0200
commit283afa44b531e9178e7476e7ab1f8f021ab0d1c9 (patch)
tree19102acc084c99ba4411b79945cd84fe83627a56 /gnu/packages
parent5ed679a2a91d84b2f651290a0a98fd5c0352f943 (diff)
downloadguix-283afa44b531e9178e7476e7ab1f8f021ab0d1c9.tar.gz
gnu: piper: Fix runtime.
The wrapper script does not add piper's own Python files to
GUIX_PYTHONPATH. Copy the approach from gtg to solve this.

Traceback (most recent call last):
  File "/gnu/store/9fq062kva6ffidilg0qn8liqn6a8yf1w-piper-0.6/bin/.piper-real", line 36, in <module>
    from piper.application import Application
ModuleNotFoundError: No module named 'piper'

* gnu/packages/gnome.scm (piper): Fix runtime.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/gnome.scm39
1 files changed, 19 insertions, 20 deletions
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 189c2002cb..fe4a667797 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -12193,26 +12193,25 @@ your operating-system definition:
            python-pycairo
            python-pygobject))
     (arguments
-     `(#:imported-modules ((guix build python-build-system)
-                           ,@%meson-build-system-modules)
-       #:modules (((guix build python-build-system) #:prefix python:)
-                  (guix build meson-build-system)
-                  (guix build utils))
-       #:tests? #f ;; The flake8 test fails trying to validate piper.in as code.
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'dont-update-gtk-icon-cache
-           (lambda _
-             (substitute* "meson.build"
-               (("meson.add_install_script('meson_install.sh')") ""))))
-         ;; TODO: Switch to wrap-script when it is fixed.
-         (add-after 'install 'wrap-python
-           (assoc-ref python:%standard-phases 'wrap))
-         (add-after 'wrap-python 'wrap
-           (lambda* (#:key outputs #:allow-other-keys)
-             (wrap-program
-                 (string-append (assoc-ref outputs "out" )"/bin/piper")
-               `("GI_TYPELIB_PATH" = (,(getenv "GI_TYPELIB_PATH")))))))))
+     (list #:glib-or-gtk? #t
+           #:tests? #f ;; The flake8 test fails trying to validate piper.in as code.
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'dont-update-gtk-icon-cache
+                 (lambda _
+                   (substitute* "meson.build"
+                     (("meson.add_install_script('meson_install.sh')") ""))))
+               (add-after 'glib-or-gtk-wrap 'python-and-gi-wrap
+                 (lambda _
+                   (let ((pylib (string-append #$output
+                                               "/lib/python"
+                                               #$(version-major+minor
+                                                  (package-version python))
+                                               "/site-packages")))
+                     (wrap-program
+                         (string-append #$output "/bin/piper")
+                       `("GUIX_PYTHONPATH" = (,(getenv "GUIX_PYTHONPATH") ,pylib))
+                       `("GI_TYPELIB_PATH" = (,(getenv "GI_TYPELIB_PATH"))))))))))
     (home-page "https://github.com/libratbag/piper/")
     (synopsis "Configure bindings and LEDs on gaming mice")
     (description "Piper is a GTK+ application for configuring gaming mice with