diff mbox series

[bug#45745] gnu: Add python-screenkey.

Message ID cbeaa51097ddd926add2a26b43cc1d1b665d695a.camel@zrythm.org
State Accepted
Headers show
Series [bug#45745] gnu: Add python-screenkey. | expand

Checks

Context Check Description
cbaines/submitting builds success
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

Alexandros Theodotou Jan. 9, 2021, 2:45 p.m. UTC
Hi,

This patch adds python-screenkey. It almost works with:
```
guix environment -L . python-screenkey --ad-hoc python-screenkey --
screenkey
```

although it can't initialize GTK.

I don't know how to fix this, if someone wants to take it from here
please go ahead.

Thanks,
Alex

Comments

Léo Le Bouter Feb. 22, 2021, 6:06 p.m. UTC | #1
Made it work and pushed as ad06c29b37924ecf5eb3bd440c7456cad6415c3b.

Have a look at the redshift package for an example on how to wrap the
final binary to include PYTHONPATH and GI_TYPELIB_PATH from the build
environment.

For this one, I added such a phase:

(add-after 'install 'wrap-screenkey
            (lambda* (#:key outputs #:allow-other-keys)
              (wrap-program
                  (string-append (assoc-ref outputs "out")
"/bin/screenkey")
                `("PYTHONPATH" ":" prefix (,(getenv "PYTHONPATH")))
                `("GI_TYPELIB_PATH"
                  ":" prefix (,(getenv "GI_TYPELIB_PATH"))))
              #t))

Thank you!
diff mbox series

Patch

From cd84aeecbcd370df5c45b077ac765b5f2e8070f4 Mon Sep 17 00:00:00 2001
From: Alexandros Theodotou <alex@zrythm.org>
Date: Sat, 9 Jan 2021 14:42:47 +0000
Subject: [PATCH] gnu: Add python-screenkey.

* gnu/packages/python-xyz.scm (python-screenkey): New variable.
---
 gnu/packages/python-xyz.scm | 49 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 23e43b7e75..87d0ba89dc 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -74,7 +74,7 @@ 
 ;;; Copyright © 2020 Sebastian Schott <sschott@mailbox.org>
 ;;; Copyright © 2020 Alexandros Theodotou <alex@zrythm.org>
 ;;; Copyright © 2020 Josh Marshall <joshua.r.marshall.1991@gmail.com>
-;;; Copyright © 2020 Alexandros Theodotou <alex@zrythm.org>
+;;; Copyright © 2020, 2021 Alexandros Theodotou <alex@zrythm.org>
 ;;; Copyright © 2020 Lars-Dominik Braun <ldb@leibniz-psychology.org>
 ;;; Copyright © 2020 Alex ter Weele <alex.ter.weele@gmail.com>
 ;;; Copyright © 2020 Matthew Kraai <kraai@ftbfs.org>
@@ -23451,3 +23451,50 @@  Qt applications.")
       "Pivy provides python bindings for Coin, a 3D graphics library with an
 Application Programming Interface based on the Open Inventor 2.1 API.")
     (license license:isc)))
+
+(define-public python-screenkey
+  (package
+    (name "python-screenkey")
+    (version "1.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.com/wavexx/screenkey.git")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1lsnkkvy9cijsalv12x746azab45xb958h00nf616kn91kiy5np1"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-dlopen-paths
+          (lambda* (#:key inputs outputs #:allow-other-keys)
+            (let* ((x11 (assoc-ref inputs "libx11"))
+                   (xtst (assoc-ref inputs "libxtst")))
+              (substitute* "Screenkey/xlib.py"
+                           (("libX11.so.6")
+                            (string-append x11 "/lib/libX11.so.6")))
+              (substitute* "Screenkey/xlib.py"
+                           (("libXtst.so.6")
+                            (string-append xtst "/lib/libXtst.so.6")))
+              #t))))))
+    (inputs
+     `(("python-distutils-extra" ,python-distutils-extra)
+       ("python-tokenize-rt" ,python-tokenize-rt)
+       ("intltool" ,intltool)
+       ("libx11" ,libx11)
+       ("libxtst" ,libxtst)
+       ("gtk+" ,gtk+)
+       ("python-pygobject" ,python-pygobject)
+       ("python-pycairo" ,python-pycairo)
+       ("python-setuptools-git" ,python-setuptools-git)))
+    (home-page "https://www.thregr.org/~wavexx/software/screenkey/")
+    (synopsis
+      "Screencast tool to display pressed keys")
+    (description
+      "A screencast tool to display your keys inspired by Screenflick.")
+    (license license:gpl3+)))
-- 
2.29.2