diff mbox series

[bug#53222] gnu: autokey fix paths.

Message ID brciF3ZHBesTmBnzZFGJl4gnkN6lwWQv8AtBxXWSoI4Qi4Cs4b6d8QI93TIUM7O8SKQ9i2hx4rP3ly9GKF35uiHA3AujZCxl3CrujK1UmlI=@protonmail.com
State Accepted
Headers show
Series [bug#53222] gnu: autokey fix paths. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

John Kehayias Jan. 14, 2022, 8:40 p.m. UTC
Hi Maxime,

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Thursday, January 13th, 2022 at 2:34 AM, Maxime Devos wrote:

>> I can submit a patch to change the wrap and inputs if that would be cleaner.
>
> * Maybe you make the GUIX_PYTHONPATH wrapping explicit (e.g. by
>   removing the wrap phase, or moving the 'wrap-autokey' phase before
>   the 'wrap', or letting it replace the 'wrap' phase), adding a comment
>
>   ;; Use 'prefix' instead of '=' to allow the user to use additional
>   ;; Python libraries from their autokey scripts.
> * or maybe don't do that, but still add a similar comment to the 'wrap'
>   phase.
> * Could you make the comment next to #:tests? a bit more explicit?
>

Okay, I hope I understood correctly, attached is a patch with these updates (on top of the already applied originally package addition).

I noticed that autokey-shell had calls to ipython3 (or python3) that should have been substituted, so I did that with the added input for ipython3.

Added the comment about the tests and GI_TYPELIB_PATH. Note that this is there because otherwise the gtk pieces won't run as it needs the girepository (I think this is also the reason this is done in most cases?). I did add the comment you suggested so it is clear this is prefix in case there are other GI paths a user wants, and that the GUIX_PYTHONPATH wrapping is done by python-build-system already.

Thanks again!
John

Comments

M Jan. 14, 2022, 10:35 p.m. UTC | #1
John Kehayias schreef op vr 14-01-2022 om 20:40 [+0000]:
> -          (add-after 'install 'wrap-autokey
> +                 (string-append "\"" (search-input-file inputs
> "bin/zenity") "\"")))
> +              (substitute* "autokey-shell"
> +                (("'ipython3'")
> +                 (string-append "'" (which "ipython3") "'"))
> +                (("'python3'")
> +                 (string-append "'" (which "python3") "'")))))

Wouldn't these also need to use use 'search-input-file'?
I think I've mentioned before why 'search-input-file' needs to be
used in these kind of contexts instead of 'which' (something with
cross-compilation), if not I can explain.

> [in propagated inputs]
> +           python-ipython
> +           wmctrl
> +           zenity

Do we need propagation here?  I don't quite see the need here
and propagation can cause trouble like profile conflcts during
partial upgrades (i.e. "guix install foo" after "guix pull"
without "guix package -u")

FWIW autokey is never used as library (except for autokey scripts
but I assume autokey scripts are interpreted in the same process
as autokey?) and wrap-program sets GUIX_PYTHONPATH so I think all
python libraries here could be depropagated?  Though that might
be getting out of scope of the original patch, so only if you want
to investigate.

Othderwise, the patch you attached LGTM.

Greetings,
Maxime.
diff mbox series

Patch

From aec4732cac7e239590c7bb85649fd99f6be2d475 Mon Sep 17 00:00:00 2001
From: John Kehayias <john.kehayias@protonmail.com>
Date: Fri, 14 Jan 2022 15:26:36 -0500
Subject: [PATCH] gnu: autokey: Fix paths.

* gnu/packages/python-xyz.scm (autokey): Add comments on the disabled tests
and GI_TYPELIB_PATH wrapping.
[inputs]: Add ipython.
[phases]{fix-paths}: Use paths to ipython3 and python3 in autokey-shell
script.
{wrap-autokey}: Change name to...
{wrap-autokey-gi}: ...this and move to before wrap for clarity.
---
 gnu/packages/python-xyz.scm | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index b85232f2b7..7ec671a476 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -4197,7 +4197,9 @@  (define-public autokey
     (build-system python-build-system)
     (arguments
      (list
-      #:tests? #f ; Tests are deprecated/broken until next version.
+      ;; Tests are deprecated and broken until next version, see
+      ;; https://github.com/autokey/autokey/issues/327
+      #:tests? #f
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'fix-paths
@@ -4206,8 +4208,16 @@  (define-public autokey
                 (("\"wmctrl\"")
                  (string-append "\"" (search-input-file inputs "bin/wmctrl") "\""))
                 (("\"zenity\"")
-                 (string-append "\"" (search-input-file inputs "bin/zenity") "\"")))))
-          (add-after 'install 'wrap-autokey
+                 (string-append "\"" (search-input-file inputs "bin/zenity") "\"")))
+              (substitute* "autokey-shell"
+                (("'ipython3'")
+                 (string-append "'" (which "ipython3") "'"))
+                (("'python3'")
+                 (string-append "'" (which "python3") "'")))))
+          ;; Use 'prefix' instead of '=' to allow the user to use additional
+          ;; GI paths from their autokey scripts.  GUIX_PYTHONPATH is already
+          ;; wrapped with prefix in python-build-system's wrap.
+          (add-before 'wrap 'wrap-autokey-gi
             (lambda _
               (let ((gi-typelib-path (getenv "GI_TYPELIB_PATH")))
                 (for-each
@@ -4223,14 +4233,14 @@  (define-public autokey
            gtksourceview-3
            libappindicator
            libnotify
-           wmctrl
-           zenity))
-    (propagated-inputs
-     (list python-dbus
+           python-dbus
+           python-ipython
            python-pygobject
            python-pyinotify
            python-pyqt+qscintilla
-           python-xlib))
+           python-xlib
+           wmctrl
+           zenity))
     (home-page "https://github.com/autokey/autokey")
     (synopsis
       "Keyboard and GUI automation utility")
-- 
2.34.0