dev-python/pynput: add v1.8.1

Patch uinput github.com/moses-palmer/pynput/issues/657
Remove deprecated bdist_wheel.universal

Signed-off-by: Dale Showers <gentoo@fictx.com>
This commit is contained in:
Dale Showers
2025-09-02 09:10:11 -04:00
parent b5af1272ef
commit 22d30ec716
4 changed files with 77 additions and 0 deletions

View File

@@ -1 +1,2 @@
DIST pynput-1.7.6.tar.gz 79501 BLAKE2B cb356271ef0688ff6532fb79b858c10fb3a52abc4f6db5f4758948cb16f01e96e9377894ea211952b58f5ff6d997ceeec9ba51a29aef866e65cd83900a9894ae SHA512 66639096a83b7ea7c926bfab67ef6c54b913fc4ffe5814bbc4ace6e4d298237a3623066f4f5c08a2bcf1cc5e40d18dc35b77c18afbd0d00b7b4bf4ed2233d9ff
DIST pynput-1.8.1.tar.gz 82289 BLAKE2B 07338c7d3f755af103d0f61874d536a0444cdddf0c3a450e51cf87e1375943fffcf20a747f25b2ca53365250e8e09d403421cf658077603b7c86a9e5794d3bd6 SHA512 4f28bbc908a4ecbfb8ef1d5b222ddc36269fe2f6361a45609afd60196eb05474569efd2267ae2028abfb85eae6825cea6215351974419ca640c7e069e6983132

View File

@@ -0,0 +1,37 @@
diff --git a/lib/pynput/_util/uinput.py b/lib/pynput/_util/uinput.py
index b0a6a78..c891b83 100644
--- a/lib/pynput/_util/uinput.py
+++ b/lib/pynput/_util/uinput.py
@@ -72,6 +72,14 @@ def _device(self, paths):
except OSError:
continue
+ # Some programmable mouse devices report each programmable input as
+ # a separate capability, so it is possible for a mouse to exceed
+ # keyboards in capability count; for this reason we will prefer a
+ # device with "keyboard" in its name
+ if 'keyboard' in next_dev.name.lower():
+ dev = next_dev
+ break
+
# Does this device provide more handled event codes?
capabilities = next_dev.capabilities()
next_count = sum(
diff --git a/lib/pynput/keyboard/_uinput.py b/lib/pynput/keyboard/_uinput.py
index 2f63dd3..747d19d 100644
--- a/lib/pynput/keyboard/_uinput.py
+++ b/lib/pynput/keyboard/_uinput.py
@@ -204,10 +204,10 @@ def as_char(k):
as_char(key): (
vk,
set()
- | {Key.shift} if i & 1 else set()
- | {Key.alt_gr} if i & 2 else set())
+ | ({Key.shift} if i & 1 else set())
+ | ({Key.alt_gr} if i & 2 else set()))
for vk, keys in self._vk_table.items()
- for i, key in enumerate(keys)
+ for i, key in reversed(list(enumerate(keys)))
if key is not None and as_char(key) is not None}
def for_vk(self, vk, modifiers):

View File

@@ -0,0 +1,11 @@
diff --git a/setup.cfg b/setup.cfg
index 99723b7..8ae701e 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,3 @@
-[bdist_wheel]
-universal = 1
-
[build_sphinx]
source-dir = docs
build-dir = build/docs

View File

@@ -0,0 +1,28 @@
# Copyright 2021-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{11..13} )
DISTUTILS_USE_PEP517=setuptools
inherit distutils-r1 pypi
DESCRIPTION="Sends virtual input commands"
HOMEPAGE="https://github.com/moses-palmer/pynput https://pypi.org/project/pynput"
RDEPEND="
dev-python/evdev[${PYTHON_USEDEP}]
X? ( dev-python/python-xlib[${PYTHON_USEDEP}] )
dev-python/six[${PYTHON_USEDEP}]
"
LICENSE="LGPL-3"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~x86"
IUSE="X"
PATCHES=(
# issue # 657
"${FILESDIR}/patches/uinput.patch"
# Remove deprecated bdist_wheel.universal
"${FILESDIR}/patches/wheel.patch"
)