Subject: [PATCH 1/3] gnu: orca: Fix invocation errors.

From: Dariqq <[email-masked]>
Date: Mon, 5 Feb 2024 15:48:36 +0000

at-spi2-atk causes 'import pyatspi' to fail.
Add orca libraries to GUIX_PYTHONPATH such that the orca modules can be found.

* gnu/pacakges/gnome.scm (orca)[inputs]: Remove at-spi2-atk.
[phases] wrap-orca: Add self to GUIX_PYTHONPATH.

Change-Id: I3a2cd1a410a4c391c6263df2d29b9ec75ecc8da4
---
 gnu/packages/gnome.scm | 42 ++++++++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 6f22529dd7..0d3fcbe086 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -11115,30 +11115,36 @@ (define-public orca
                 "097pyav3z5ssic8vwd7v1s7vynpycdpyfr324rr6c7mfzq5vmp7s"))))
     (build-system glib-or-gtk-build-system)
     (arguments
-     '(#:phases
-       (modify-phases %standard-phases
-         (add-before 'configure 'qualify-xkbcomp
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((xkbcomp (string-append
-                             (assoc-ref inputs "xkbcomp") "/bin/xkbcomp")))
-               (substitute* "src/orca/orca.py"
-                 (("'xkbcomp'") (format #f "'~a'" xkbcomp))))))
-         (add-after 'install 'wrap-orca
-           (lambda* (#:key outputs #:allow-other-keys)
-             (wrap-program (search-input-file outputs "bin/orca")
-               `("GI_TYPELIB_PATH" ":" prefix
-                 (,(getenv "GI_TYPELIB_PATH")))
-               `("GST_PLUGIN_SYSTEM_PATH" ":" prefix
-                 (,(getenv "GST_PLUGIN_SYSTEM_PATH")))
-               `("GUIX_PYTHONPATH" ":" prefix
-                 (,(getenv "GUIX_PYTHONPATH")))))))))
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'configure 'qualify-xkbcomp
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let ((xkbcomp (string-append
+                              (assoc-ref inputs "xkbcomp") "/bin/xkbcomp")))
+                (substitute* "src/orca/orca.py"
+                  (("'xkbcomp'") (format #f "'~a'" xkbcomp))))))
+          (add-after 'set-install 'wrap-orca
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (pylib (string-append out "/lib/python"
+                                           #$(version-major+minor
+                                              (package-version (this-package-input "python")))
+                                           "/site-packages")))
+                (wrap-program (search-input-file outputs "bin/orca")
+                  `("GI_TYPELIB_PATH" ":" prefix
+                    (,(getenv "GI_TYPELIB_PATH")))
+                  `("GST_PLUGIN_SYSTEM_PATH" ":" prefix
+                    (,(getenv "GST_PLUGIN_SYSTEM_PATH")))
+                  `("GUIX_PYTHONPATH" ":" prefix
+                    (,(getenv "GUIX_PYTHONPATH") ,pylib)))))))))
     (native-inputs
      (list gettext-minimal
            itstool
            pkg-config
            libxml2))
     (inputs
-     (list at-spi2-atk
+     (list ;; at-spi2-atk
            bash-minimal
            gsettings-desktop-schemas
            gstreamer
-- 
2.41.0