GNU bug report logs - #53222
[PATCH] gnu: Add autokey.

Previous Next

Package: guix-patches;

Reported by: John Kehayias <john.kehayias <at> protonmail.com>

Date: Wed, 12 Jan 2022 21:04:01 UTC

Severity: normal

Tags: patch

Done: Nicolas Goaziou <mail <at> nicolasgoaziou.fr>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 53222 in the body.
You can then email your comments to 53222 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#53222; Package guix-patches. (Wed, 12 Jan 2022 21:04:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to John Kehayias <john.kehayias <at> protonmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 12 Jan 2022 21:04:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: Guix-patches <guix-patches <at> gnu.org>
Cc: "~whereiseveryone/guixrus <at> lists.sr.ht"
 <~whereiseveryone/guixrus <at> lists.sr.ht>
Subject: [PATCH] gnu: Add autokey.
Date: Wed, 12 Jan 2022 21:03:00 +0000
[Message part 1 (text/plain, inline)]
Hello,

Here is a patch for autokey, a python based program for things like keyboard shortcuts and text expansion. I find it invaluable for having emacs-like keys everywhere.

It includes both a gtk and qt frontend; after discussion on IRC I decided against trying to split them. Since it is one package and it is built together, it is a bit tricky I think to disentangle the code and paths needed for each. In my first attempts it didn't reduce the closure and needed a lot of manual work. Possibly it could work with more effort, but since this is used as a GUI tool primarily, the GTK/QT packages shouldn't be adding anything new.

John
[0001-gnu-Add-autokey.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#53222; Package guix-patches. (Wed, 12 Jan 2022 21:23:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
To: John Kehayias via Guix-patches via <guix-patches <at> gnu.org>
Cc: John Kehayias <john.kehayias <at> protonmail.com>,
 "~whereiseveryone/guixrus <at> lists.sr.ht"
 <~whereiseveryone/guixrus <at> lists.sr.ht>, 53222-done <at> debbugs.gnu.org
Subject: Re: [bug#53222] [PATCH] gnu: Add autokey.
Date: Wed, 12 Jan 2022 22:22:11 +0100
Hello,

John Kehayias via Guix-patches via <guix-patches <at> gnu.org> writes:

> Here is a patch for autokey, a python based program for things like
> keyboard shortcuts and text expansion. I find it invaluable for having
> emacs-like keys everywhere.

Applied. Thank you.

Regards,
-- 
Nicolas Goaziou




Reply sent to Nicolas Goaziou <mail <at> nicolasgoaziou.fr>:
You have taken responsibility. (Wed, 12 Jan 2022 21:23:02 GMT) Full text and rfc822 format available.

Notification sent to John Kehayias <john.kehayias <at> protonmail.com>:
bug acknowledged by developer. (Wed, 12 Jan 2022 21:23:03 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#53222; Package guix-patches. (Wed, 12 Jan 2022 21:27:02 GMT) Full text and rfc822 format available.

Message #16 received at 53222 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: John Kehayias <john.kehayias <at> protonmail.com>, 53222 <at> debbugs.gnu.org
Cc: "~whereiseveryone/guixrus <at> lists.sr.ht"
 <~whereiseveryone/guixrus <at> lists.sr.ht>
Subject: Re: [bug#53222] [PATCH] gnu: Add autokey.
Date: Wed, 12 Jan 2022 22:26:02 +0100
[Message part 1 (text/plain, inline)]
Hi,

John Kehayias via Guix-patches via schreef op wo 12-01-2022 om 21:03
[+0000]:
> +      #:tests? #f ; Tests are deprecated/broken until next version.

How can a test be deprecated?
What tests are broken?
Are the tests broken, or do they fail because of a real issue?

> +                   (wrap-program program
> +                     `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-
> path))))

Do we need to include the GI_TYPELIB_PATH from the environment?
If not, I recommend '=' instead of 'prefix' to avoid potential trouble.

> +                 (map (lambda (name)
> +                        (string-append #$output "/bin/" name))
> +                      '("autokey-gtk"
> +                        "autokey-shell")))))))))
> +    (inputs
> +     (list bash-minimal ; for wrap-program
> +           gtksourceview-3
> +           libappindicator
> +           libnotify
> +           wmctrl
> +           zenity))
> +    (propagated-inputs
> +     (list python-dbus
> +           python-pygobject
> +           python-pyinotify
> +           python-pyqt+qscintilla

If you add "GUIX_PYTHONPATH"  to the wrap-program,
then probably the propagated inputs can be moved to the regular inputs
(since 'autokey' appeas to be used as a few binaries and not
as a python _library_).

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 12 Jan 2022 21:28:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#53222; Package guix-patches. (Wed, 12 Jan 2022 21:56:01 GMT) Full text and rfc822 format available.

Message #21 received at 53222 <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: Maxime Devos <maximedevos <at> telenet.be>,
 Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
Cc: 53222 <at> debbugs.gnu.org
Subject: Re: [bug#53222] [PATCH] gnu: Add autokey.
Date: Wed, 12 Jan 2022 21:55:01 +0000
Hi Maxime and Nicolas,

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

On Wednesday, January 12th, 2022 at 4:26 PM, Maxime Devos wrote:

> > +      #:tests? #f ; Tests are deprecated/broken until next version.
>
> How can a test be deprecated?
> What tests are broken?
> Are the tests broken, or do they fail because of a real issue?
>
Sort of both? They relied on python2 and had not been updated, so they didn't work (at all from what I see) and were therefore due for replacement in the new version (forthcoming).

See https://github.com/autokey/autokey/issues/327 where they say "The current tests are deprecated and won’t work." That's why I said it that way in the comment, sorry if that wasn't clear. The new version that seems due soon has a new test framework (tox).

> > +                   (wrap-program program
> > +                     `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-
> > path))))
>
> Do we need to include the GI_TYPELIB_PATH from the environment?
> If not, I recommend '=' instead of 'prefix' to avoid potential trouble.
>

I'm not sure, I was following the examples I saw. For whatever reason, nearly all of them do it that way (I think I only saw one or two as '=', in my quick look). Anyway, I think you are right that it shouldn't be needed, probably the same for a lot of other packages? I think it works with '=' instead, in my quick test.

>
> If you add "GUIX_PYTHONPATH"  to the wrap-program,
> then probably the propagated inputs can be moved to the regular inputs
> (since 'autokey' appeas to be used as a few binaries and not
> as a python library).
>

I'm confused on this as these are already wrapped with GUIX_PYTHONPATH (the bin outputs are python scripts) without adding it explicitly. Trying with the propagated-inputs being regular inputs seems to work fine too.

Although I haven't used it this way, there is also scripting with autokey. One of the included programs is autokey-shell which is a python shell of sorts. I'm not sure if that would make a difference and I don't have anything offhand to test with.

I can submit a patch to change the wrap and inputs if that would be cleaner.

Thanks!
John




Information forwarded to guix-patches <at> gnu.org:
bug#53222; Package guix-patches. (Thu, 13 Jan 2022 07:36:01 GMT) Full text and rfc822 format available.

Message #24 received at 53222 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: John Kehayias <john.kehayias <at> protonmail.com>, Nicolas Goaziou
 <mail <at> nicolasgoaziou.fr>
Cc: 53222 <at> debbugs.gnu.org
Subject: Re: [bug#53222] [PATCH] gnu: Add autokey.
Date: Thu, 13 Jan 2022 08:34:51 +0100
[Message part 1 (text/plain, inline)]
John Kehayias schreef op wo 12-01-2022 om 21:55 [+0000]:
> Hi Maxime and Nicolas,
> 
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> 
> On Wednesday, January 12th, 2022 at 4:26 PM, Maxime Devos wrote:
> 
> > > +      #:tests? #f ; Tests are deprecated/broken until next version.
> > 
> > How can a test be deprecated?
> > What tests are broken?
> > Are the tests broken, or do they fail because of a real issue?
> > 
> Sort of both? They relied on python2 and had not been updated, so they didn't work (at all from what I see) and were therefore due for replacement in the new version (forthcoming).
> 
> See https://github.com/autokey/autokey/issues/327 where they say "The current tests are deprecated and won’t work." That's why I said it that way in the comment, sorry if that wasn't clear. The new version that seems due soon has a new test framework (tox).

Adding a link to <https://github.com/autokey/autokey/issues/327> in the
comment should be sufficient:

  ;; Tests are deprecated and broken until the next version, see
  ;; <https://github.com/autokey/autokey/issues/327>.
  #:tests? #false

> > > +                   (wrap-program program
> > > +                     `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-
> > > path))))
> > 
> > Do we need to include the GI_TYPELIB_PATH from the environment?
> > If not, I recommend '=' instead of 'prefix' to avoid potential trouble.
> > 
> 
> I'm not sure, I was following the examples I saw. For whatever reason, nearly all of them do it that way (I think I only saw one or two as '=', in my quick look). Anyway, I think you are right that it shouldn't be needed, probably the same for a lot of other packages? I think it works with '=' instead, in my quick test.

I think it isn't needed, but because it allows scripting in python
(and hence can benefit from any python libraries in the environment,
possibly including python libraries using GI_TYPELIB_PATH) ...

> > 
> > If you add "GUIX_PYTHONPATH"  to the wrap-program,
> > then probably the propagated inputs can be moved to the regular inputs
> > (since 'autokey' appeas to be used as a few binaries and not
> > as a python library).
> > 
> 
> I'm confused on this as these are already wrapped with GUIX_PYTHONPATH (the bin outputs are python scripts) without adding it explicitly. Trying with the propagated-inputs being regular inputs seems to work fine too.

(seems like this is done implicitely by 'wrap' in (guix build python-
build-system))

> Although I haven't used it this way, there is also scripting with autokey. One of the included programs is autokey-shell which is a python shell of sorts. I'm not sure if that would make a difference and I don't have anything offhand to test with.

it would be nice if the user could install additional python libraries
to use from their scripts, so I think 'prefix' would be better here.
(If I'm not mistaken about Python's loading order, locations early in
GUIX_PYTHONPATH have priority above later entries, so there shouldn't
be any problems unless autokey has undeclared dependencies).

> 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?

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#53222; Package guix-patches. (Fri, 14 Jan 2022 20:41:02 GMT) Full text and rfc822 format available.

Message #27 received at 53222 <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: 53222 <at> debbugs.gnu.org, Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
Subject: Re: [bug#53222] [PATCH] gnu: autokey fix paths.
Date: Fri, 14 Jan 2022 20:40:11 +0000
[Message part 1 (text/plain, inline)]
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
[0001-gnu-autokey-Fix-paths.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#53222; Package guix-patches. (Fri, 14 Jan 2022 22:36:02 GMT) Full text and rfc822 format available.

Message #30 received at 53222 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: John Kehayias <john.kehayias <at> protonmail.com>
Cc: 53222 <at> debbugs.gnu.org, Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
Subject: Re: [bug#53222] [PATCH] gnu: autokey fix paths.
Date: Fri, 14 Jan 2022 23:35:18 +0100
[Message part 1 (text/plain, inline)]
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.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#53222; Package guix-patches. (Fri, 14 Jan 2022 22:49:01 GMT) Full text and rfc822 format available.

Message #33 received at 53222 <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: 53222 <at> debbugs.gnu.org, Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
Subject: Re: [bug#53222] [PATCH] gnu: autokey fix paths.
Date: Fri, 14 Jan 2022 22:48:09 +0000
[Message part 1 (text/plain, inline)]
Hi Maxime,

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

On Friday, January 14th, 2022 at 5:35 PM, Maxime Devos wrote:

>
> 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.
>

That sounds vaguely familiar and makes sense. I've updated it to do that (not sure why I switched, probably since I was using that somewhere else).

> 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.
>

None of the inputs are propagated now (might have been confusing looking at just this patch), all are regular inputs. Runs fine and is a good point I'll keep in mind for other python programs versus libraries.

> Othderwise, the patch you attached LGTM.
>

Just to be clear, this patch (most recent version attached) is just to do these final tweaks on top of the original patch which added autokey (as that was already pushed). So I think everything should be good now?

Thanks for the review and instructive changes!
John
[0001-gnu-autokey-Fix-paths.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#53222; Package guix-patches. (Sat, 15 Jan 2022 11:18:02 GMT) Full text and rfc822 format available.

Message #36 received at 53222 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: John Kehayias <john.kehayias <at> protonmail.com>
Cc: 53222 <at> debbugs.gnu.org, Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
Subject: Re: [bug#53222] [PATCH] gnu: autokey fix paths.
Date: Sat, 15 Jan 2022 12:17:43 +0100
[Message part 1 (text/plain, inline)]
John Kehayias schreef op vr 14-01-2022 om 22:48 [+0000]:
> [...]
> None of the inputs are propagated now (might have been confusing looking at just this patch), all are regular inputs. [...]

Indeed, I didn't notice the

> -    (propagated-inpits

line.

> [...] So I think everything should be good now?

AFAICT, yes.

Greetings,
MAxome.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#53222; Package guix-patches. (Sat, 15 Jan 2022 20:04:01 GMT) Full text and rfc822 format available.

Message #39 received at 53222 <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: 53222 <at> debbugs.gnu.org, Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
Subject: Re: [bug#53222] [PATCH] gnu: autokey fix paths.
Date: Sat, 15 Jan 2022 20:03:11 +0000
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Saturday, January 15th, 2022 at 6:17 AM, Maxime Devos <maximedevos <at> telenet.be> wrote:

> John Kehayias schreef op vr 14-01-2022 om 22:48 [+0000]:
>
> [...]
> > [...] So I think everything should be good now?
>
> AFAICT, yes.
>

Great, thanks for the instructive review again!

John




Reply sent to Nicolas Goaziou <mail <at> nicolasgoaziou.fr>:
You have taken responsibility. (Sat, 15 Jan 2022 20:33:01 GMT) Full text and rfc822 format available.

Notification sent to John Kehayias <john.kehayias <at> protonmail.com>:
bug acknowledged by developer. (Sat, 15 Jan 2022 20:33:02 GMT) Full text and rfc822 format available.

Message #44 received at 53222-done <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
To: John Kehayias via Guix-patches via <guix-patches <at> gnu.org>
Cc: John Kehayias <john.kehayias <at> protonmail.com>,
 Maxime Devos <maximedevos <at> telenet.be>, 53222-done <at> debbugs.gnu.org
Subject: Re: [bug#53222] [PATCH] gnu: autokey fix paths.
Date: Sat, 15 Jan 2022 21:32:51 +0100
Hello,

John Kehayias via Guix-patches via <guix-patches <at> gnu.org> writes:

> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>
> On Saturday, January 15th, 2022 at 6:17 AM, Maxime Devos <maximedevos <at> telenet.be> wrote:
>
>> John Kehayias schreef op vr 14-01-2022 om 22:48 [+0000]:
>>
>> [...]
>> > [...] So I think everything should be good now?
>>
>> AFAICT, yes.
>>
>
> Great, thanks for the instructive review again!

Applied. Thank you, and thanks to Maxime for the in-depth review.

Regards,
-- 
Nicolas Goaziou




Information forwarded to guix-patches <at> gnu.org:
bug#53222; Package guix-patches. (Sat, 15 Jan 2022 20:34:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 13 Feb 2022 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 73 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.