x11-apps/autokey: new package, add 0.96.0

Signed-off-by: Niklaus 'vimja' Hofer <gentoo-bugzilla@vimja.email>
This commit is contained in:
Niklaus 'vimja' Hofer
2026-03-07 22:14:04 +01:00
parent 9ca1b953b1
commit 3f0d3250c9
7 changed files with 273 additions and 0 deletions

View File

@@ -0,0 +1 @@
DIST autokey-0.96.0.tar.gz 217164 BLAKE2B fdbcd087f7466bb1726effd7edf4f363eb1e67f92d97c06354581a8e31e1f599700e90959d2363b6a12f467bf79f33c5aba63d5efe01fccdf9a33f46858814ff SHA512 3475f084bc16c74df1e1ff5beb5b10d9aa4a97466af58fb32d7204face6c78e3fc613e7007e37298f35d43c22e202b855b34646cd28ae20b6ffe188ce23cad80

View File

@@ -0,0 +1,80 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{12..13} )
inherit distutils-r1 pypi
DESCRIPTION="AutoKey, a desktop automation utility for Linux and X11."
HOMEPAGE="
https://github.com/autokey/autokey
"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
IUSE="+gtk qt5"
RDEPEND="dev-python/dbus-python[${PYTHON_USEDEP}]
dev-python/pyinotify[${PYTHON_USEDEP}]
dev-python/python-xlib[${PYTHON_USEDEP}]
dev-python/pyhamcrest[${PYTHON_USEDEP}]
media-gfx/imagemagick
x11-misc/xautomation
x11-misc/wmctrl
gtk? (
dev-python/pygobject[${PYTHON_USEDEP}]
gnome-extra/zenity
dev-libs/libayatana-appindicator
x11-libs/gtksourceview:3.0
)
qt5? (
dev-python/pyqt5[${PYTHON_USEDEP}]
dev-python/qscintilla[${PYTHON_USEDEP}]
)
"
BDEPEND="
test? (
dev-python/pytest[${PYTHON_USEDEP}]
dev-python/pytest-cov[${PYTHON_USEDEP}]
>=dev-python/pyhamcrest-2.1.0[${PYTHON_USEDEP}]
dev-python/coverage
)
"
src_compile() {
eapply "${FILESDIR}"/0001-scripting-Remove-dependency-on-imghdr.patch
if ! use qt5; then
rm --verbose --force --recursive "${S}/lib/autokey/qtui"
rm --verbose --force --recursive "${S}/lib/autokey/qtapp.py"
rm --verbose --force --recursive "${S}/lib/autokey/scripting/clipboard_qt.py"
rm --verbose --force --recursive "${S}/lib/autokey/scripting/dialog_qt.py"
rm --verbose --force --recursive "${S}/config/autokey-qt.desktop"
rm --verbose --force --recursive "${S}/doc/man/autokey-qt.1"
if use gtk; then
eapply "${FILESDIR}"/noqt.patch
fi
fi
if ! use gtk; then
rm --verbose --force --recursive "${S}/lib/autokey/gtkui"
rm --verbose --force --recursive "${S}/lib/autokey/gtkapp.py"
rm --verbose --force --recursive "${S}/lib/autokey/scripting/clipboard_gtk.py"
rm --verbose --force --recursive "${S}/lib/autokey/scripting/dialog_gtk.py"
rm --verbose --force --recursive "${S}/config/autokey-gtk.desktop"
rm --verbose --force --recursive "${S}/doc/man/autokey-gtk.1"
if ! use qt5; then
eapply "${FILESDIR}"/noqt-nogtk.patch
else
eapply "${FILESDIR}"/nogtk.patch
fi
fi
distutils-r1_src_compile
}
distutils_enable_tests pytest

View File

@@ -0,0 +1,68 @@
From b4e2f89b869bf8cfb8ab5fd918a8cd30edd68d6c Mon Sep 17 00:00:00 2001
From: Till Maas <opensource@till.name>
Date: Fri, 17 Jan 2025 14:42:08 +0100
Subject: [PATCH] scripting: Remove dependency on imghdr
The imghdr module was removed in Python 3.13, use magic instead.
References:
https://github.com/autokey/autokey/pull/992/files#diff-0d8c52dae5aa11f6c84e8a1ad42f55143fb8ff26267eb82022a3513d56bc84d8
Author: dlk3 <dave@daveking.com>
Signed-off-by: Till Maas <opensource@till.name>
---
lib/autokey/scripting/highlevel.py | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/lib/autokey/scripting/highlevel.py b/lib/autokey/scripting/highlevel.py
index b55f641..736ff9d 100644
--- a/lib/autokey/scripting/highlevel.py
+++ b/lib/autokey/scripting/highlevel.py
@@ -6,9 +6,9 @@ import time
import os
import subprocess
import tempfile
-import imghdr
import struct
+import magic
class PatternNotFound(Exception):
"""Exception raised by functions"""
@@ -33,7 +33,7 @@ def visgrep(scr: str, pat: str, tolerance: int = 0) -> int:
Usage: C{visgrep("screen.png", "pat.png")}
-
+
@param scr: path of PNG image to be grepped.
@param pat: path of pattern image (PNG) to look for in scr.
@@ -72,10 +72,11 @@ def get_png_dim(filepath: str) -> int:
@returns: (width, height).
@raise Exception: Raised if the file is not a png
"""
- if not imghdr.what(filepath) == 'png':
- raise Exception("not PNG")
- head = open(filepath, 'rb').read(24)
- return struct.unpack('!II', head[16:24])
+ with open(filepath, 'rb') as f:
+ if not magic.detect_from_fobj(f).mime_type == "image/png":
+ raise Exception("not PNG")
+ head = f.read(24)
+ return struct.unpack('!II', head[16:24])
def mouse_move(x: int, y: int, display: str=''):
@@ -144,7 +145,7 @@ def move_to_pat(pat: str, offset: (float, float)=None, tolerance: int=0) -> None
"""See L{click_on_pat}"""
with tempfile.NamedTemporaryFile() as f:
subprocess.call('''
- xwd -root -silent -display :0 |
+ xwd -root -silent -display :0 |
convert xwd:- png:''' + f.name, shell=True)
loc = visgrep(f.name, pat, tolerance)
pat_size = get_png_dim(pat)
--
2.48.0

View File

@@ -0,0 +1,30 @@
--- a/setup.py 2026-03-07 21:28:49.175376290 +0100
+++ b/setup.py 2026-03-07 21:31:22.254308803 +0100
@@ -139,8 +139,7 @@
package_dir={'': 'lib'},
package_data={'autokey': ["configmanager/predefined_user_scripts/*"],
- 'autokey.qtui': ['data/*', 'resources/icons/*', 'resources/ui/*.ui'],
- 'autokey.gtkui': ['data/*']},
+ 'autokey.qtui': ['data/*', 'resources/icons/*', 'resources/ui/*.ui']},
data_files=[('share/icons/hicolor/scalable/apps',
['config/autokey.svg',
'config/autokey-status.svg',
@@ -158,16 +157,13 @@
['config/ubuntu-mono-light/autokey-status.svg',
'config/ubuntu-mono-light/autokey-status-error.svg']),
('share/applications',
- ['config/autokey-qt.desktop',
- 'config/autokey-gtk.desktop']),
+ ['config/autokey-qt.desktop']),
('share/man/man1/',
['doc/man/autokey-qt.1',
- 'doc/man/autokey-gtk.1',
'doc/man/autokey-run.1'])
],
entry_points={
'console_scripts': [
- 'autokey-gtk=autokey.gtkui.__main__:main',
'autokey-qt=autokey.qtui.__main__:Application'
]
},

View File

@@ -0,0 +1,43 @@
--- a/setup.py 2026-03-07 21:28:49.175376290 +0100
+++ b/setup.py 2026-03-07 21:32:55.685275978 +0100
@@ -127,7 +127,6 @@
maintainer=ak_data.maintainer,
maintainer_email=ak_data.maintainer_email,
url='https://github.com/autokey/autokey',
- cmdclass={'build_py': BuildWithQtResources},
license='GPLv3',
python_requires=">=3.5",
# This requires autokey submodules (subdirectories) to contain their own `__init__.py` file (i.e.
@@ -138,9 +137,7 @@
packages=setuptools.find_packages('lib'),
package_dir={'': 'lib'},
- package_data={'autokey': ["configmanager/predefined_user_scripts/*"],
- 'autokey.qtui': ['data/*', 'resources/icons/*', 'resources/ui/*.ui'],
- 'autokey.gtkui': ['data/*']},
+ package_data={'autokey': ["configmanager/predefined_user_scripts/*"]},
data_files=[('share/icons/hicolor/scalable/apps',
['config/autokey.svg',
'config/autokey-status.svg',
@@ -157,20 +154,9 @@
('share/icons/ubuntu-mono-light/apps/48',
['config/ubuntu-mono-light/autokey-status.svg',
'config/ubuntu-mono-light/autokey-status-error.svg']),
- ('share/applications',
- ['config/autokey-qt.desktop',
- 'config/autokey-gtk.desktop']),
('share/man/man1/',
- ['doc/man/autokey-qt.1',
- 'doc/man/autokey-gtk.1',
- 'doc/man/autokey-run.1'])
+ ['doc/man/autokey-run.1'])
],
- entry_points={
- 'console_scripts': [
- 'autokey-gtk=autokey.gtkui.__main__:main',
- 'autokey-qt=autokey.qtui.__main__:Application'
- ]
- },
scripts=['autokey-run', 'autokey-shell'],
# Minimal installation pre-requisite python packages.
# Some are not included here because they should be installed

View File

@@ -0,0 +1,39 @@
--- a/setup.py 2026-03-07 21:28:49.175376290 +0100
+++ b/setup.py 2026-03-07 21:32:12.968384902 +0100
@@ -127,7 +127,6 @@
maintainer=ak_data.maintainer,
maintainer_email=ak_data.maintainer_email,
url='https://github.com/autokey/autokey',
- cmdclass={'build_py': BuildWithQtResources},
license='GPLv3',
python_requires=">=3.5",
# This requires autokey submodules (subdirectories) to contain their own `__init__.py` file (i.e.
@@ -139,7 +138,6 @@
package_dir={'': 'lib'},
package_data={'autokey': ["configmanager/predefined_user_scripts/*"],
- 'autokey.qtui': ['data/*', 'resources/icons/*', 'resources/ui/*.ui'],
'autokey.gtkui': ['data/*']},
data_files=[('share/icons/hicolor/scalable/apps',
['config/autokey.svg',
@@ -158,17 +156,14 @@
['config/ubuntu-mono-light/autokey-status.svg',
'config/ubuntu-mono-light/autokey-status-error.svg']),
('share/applications',
- ['config/autokey-qt.desktop',
- 'config/autokey-gtk.desktop']),
+ ['config/autokey-gtk.desktop']),
('share/man/man1/',
- ['doc/man/autokey-qt.1',
- 'doc/man/autokey-gtk.1',
+ ['doc/man/autokey-gtk.1',
'doc/man/autokey-run.1'])
],
entry_points={
'console_scripts': [
- 'autokey-gtk=autokey.gtkui.__main__:main',
- 'autokey-qt=autokey.qtui.__main__:Application'
+ 'autokey-gtk=autokey.gtkui.__main__:main'
]
},
scripts=['autokey-run', 'autokey-shell'],

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>gentoo-bugzilla@vimja.email</email>
<name>Niklaus 'vimja' Hofer</name>
</maintainer>
<upstream>
<remote-id type="pypi">autokey</remote-id>
<remote-id type="github">autokey/autokey</remote-id>
</upstream>
</pkgmetadata>