Subject: Re: [bug#53222] [PATCH] gnu: Add autokey.

From: Maxime Devos <[email-masked]>
Date: Thu, 13 Jan 2022 08:34:51 +0100

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.