summary refs log tree commit diff
path: root/pkgs/applications/video/screenkey
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2020-08-14 19:52:58 +0300
committerDoron Behar <doron.behar@gmail.com>2020-08-17 18:17:42 +0300
commitb5caca265e97123af8fd850f2347cfd4aad258a4 (patch)
tree13a6c79de47bfb75a5ab8e8b4affc559d7d34854 /pkgs/applications/video/screenkey
parent800d9e77fe80c98b93e60a33e803f10d477f0664 (diff)
screenkey: 0.9 -> 1.2
- Use Python 3.
- Switch to gobject-introspection and other more maintained libraries
(vs PyGTK).
- Use `fetchFromGitLab`.
- Replace the non absolute paths fix in `xlib.py` with
`substituteInPlace`.
Diffstat (limited to 'pkgs/applications/video/screenkey')
-rw-r--r--pkgs/applications/video/screenkey/default.nix69
-rw-r--r--pkgs/applications/video/screenkey/paths.patch20
2 files changed, 41 insertions, 48 deletions
diff --git a/pkgs/applications/video/screenkey/default.nix b/pkgs/applications/video/screenkey/default.nix
index 7e2bc3a3ec0cf..00ead0f89a39a 100644
--- a/pkgs/applications/video/screenkey/default.nix
+++ b/pkgs/applications/video/screenkey/default.nix
@@ -1,53 +1,66 @@
 { lib
-, substituteAll
-, buildPythonApplication
-, fetchFromGitHub
-, distutils_extra
-, setuptools-git
+, fetchFromGitLab
+# native
 , intltool
-, pygtk
-, libX11
-, libXtst
 , wrapGAppsHook
-, gnome3
+, file
+# not native
+, xorg
+, gobject-introspection
+, gtk3
+, python3
 }:
-buildPythonApplication rec {
+
+python3.pkgs.buildPythonApplication rec {
   pname = "screenkey";
-  version = "0.9";
+  version = "1.2";
 
-  src = fetchFromGitHub {
-    owner = "wavexx";
+  src = fetchFromGitLab {
+    owner = "screenkey";
     repo = "screenkey";
-    rev = "screenkey-${version}";
-    sha256 = "14g7fiv9n7m03djwz1pp5034pffi87ssvss9bc1q8vq0ksn23vrw";
+    rev = "v${version}";
+    sha256 = "1x13n57iy2pg3h3r994q3g5nbmh2gwk3qidmmcv0g7qa89n2gwbj";
   };
 
-  patches = [
-    (substituteAll {
-      src = ./paths.patch;
-      inherit libX11 libXtst;
-    })
-  ];
-
   nativeBuildInputs = [
-    distutils_extra
-    setuptools-git
+    python3.pkgs.distutils_extra
+    # Shouldn't be needed once https://gitlab.com/screenkey/screenkey/-/issues/122 is fixed.
     intltool
-
+    # We are not sure why is this needed, but without it we get "file: command
+    # not found" errors during build.
+    file
     wrapGAppsHook
+    # for setup hook
+    gobject-introspection
   ];
 
   buildInputs = [
-    gnome3.adwaita-icon-theme
+    gtk3
   ];
 
-  propagatedBuildInputs = [
-    pygtk
+  propagatedBuildInputs = with python3.pkgs; [
+    pycairo
+    pygobject3
   ];
 
+  # Prevent double wrapping because of wrapGAppsHook
+  dontWrapGApps = true;
+  # https://github.com/NixOS/nixpkgs/issues/56943
+  strictDeps = false;
+  preFixup = ''
+    makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
+  '';
+
   # screenkey does not have any tests
   doCheck = false;
 
+  # Fix CDLL python calls for non absolute paths of xorg libraries
+  postPatch = ''
+    substituteInPlace Screenkey/xlib.py \
+      --replace libX11.so.6 ${lib.getLib xorg.libX11}/lib/libX11.so.6 \
+      --replace libXtst.so.6 ${lib.getLib xorg.libXtst}/lib/libXtst.so.6
+  '';
+
   meta = with lib; {
     homepage = "https://www.thregr.org/~wavexx/software/screenkey/";
     description = "A screencast tool to display your keys inspired by Screenflick";
diff --git a/pkgs/applications/video/screenkey/paths.patch b/pkgs/applications/video/screenkey/paths.patch
deleted file mode 100644
index 7e5ed47fc19da..0000000000000
--- a/pkgs/applications/video/screenkey/paths.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/Screenkey/xlib.py
-+++ b/Screenkey/xlib.py
-@@ -6,7 +6,7 @@
- from ctypes import *
- 
- ## base X11
--libX11 = CDLL('libX11.so.6')
-+libX11 = CDLL('@libX11@/lib/libX11.so.6')
- 
- # types
- Atom = c_ulong
-@@ -278,7 +278,7 @@
- 
- 
- ## record extensions
--libXtst = CDLL('libXtst.so.6')
-+libXtst = CDLL('@libXtst@/lib/libXtst.so.6')
- 
- # types
- XPointer = String
\ No newline at end of file