summaryrefslogtreecommitdiff
diff options
authorBoyuan Yang <byang@debian.org>2024-03-17 18:00:59 -0400
committergit-ubuntu importer <ubuntu-devel-discuss@lists.ubuntu.com>2024-03-18 04:35:39 +0000
commit490a4cd936ac2a354b7ff8c70d76d12aed281e48 (patch)
tree4dd179a03945c391d5ee819bd9d89082b5d779d3
parentd4ea2d58014c7bee6a3423039e296c6dc64f4183 (diff)
1.0.1-1 (patches unapplied)import/1.0.1-1
Imported using git-ubuntu import.
Notes
Notes: * Team upload. * Switch to the official active upstream project. * New upstream release. * debian/watch: Monitor the correct upstream release. * debian/patches: Dropped, merged upstream. * debian/control: Use the new upstream information. * debian/control: Migrate to use pyproject.toml to build the project.
-rw-r--r--.gitignore7
-rw-r--r--AUTHORS1
l---------LICENSE1
-rw-r--r--NEWS.rst8
-rw-r--r--README.rst10
-rw-r--r--debian/changelog12
-rw-r--r--debian/control3
-rw-r--r--debian/patches/0001-Migrate-from-distutils-to-setuptools.patch37
-rw-r--r--debian/patches/series1
-rw-r--r--debian/watch4
-rw-r--r--pyproject.toml38
-rw-r--r--setup.py20
-rw-r--r--src/__init__.py16
-rw-r--r--src/ev.py2
-rw-r--r--tests/test_uinput.py23
15 files changed, 123 insertions, 60 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..6680e53
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+**/*.pyc
+**/*.swp
+**/*.egg-info/
+build/
+dist/
+_libsuinput.so
+
diff --git a/AUTHORS b/AUTHORS
index d9b079e..02c6efe 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,7 +1,6 @@
Eric Mikula <e.e.mikula@gmail.com>
Esa-Matti Suuronen <esa-matti@suuronen.org>
Fabian Deutsch <fabiand@redhat.com>
-Goncalo Pinheira <goncalopp+github@quorumverita.com>
Kevin Ward <kevinward@fescorp.com>
Pascal Garber <jumplink@gmail.com>
Tuomas Räsänen <tuomasjjrasanen@tjjr.fi>
diff --git a/LICENSE b/LICENSE
new file mode 120000
index 0000000..d24842f
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1 @@
+COPYING \ No newline at end of file
diff --git a/NEWS.rst b/NEWS.rst
index 7a4f6e9..ee2cd14 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -2,6 +2,14 @@
Python-uinput NEWS -- history of user-visible changes
=======================================================
+1.0
+===
+
+- Project repository moved to pyinput/python-uinput
+- Development Status: Stable
+- Modern packaging (pyproject.toml)
+- Python 3.12 support
+
0.11.2
======
diff --git a/README.rst b/README.rst
index 6b07d17..0196d34 100644
--- a/README.rst
+++ b/README.rst
@@ -1,6 +1,6 @@
-===============
+==============
Python-uinput
-===============
+==============
Python-uinput is Python interface to Linux uinput kernel module which
allows attaching userspace device drivers into kernel. In practice,
@@ -8,7 +8,7 @@ Python-uinput makes it dead simple to create virtual joysticks,
keyboards and mice for generating arbitrary input events
programmatically.
-:Homepage: http://tjjr.fi/sw/python-uinput/
+:Homepage: https://github.com/pyinput/python-uinput
:License: GPLv3+
Usage examples
@@ -75,7 +75,7 @@ How to report bugs
The bug database is hosted in GitHub. If you have found a bug or have an
improvement idea you want to share, please report it at
-<https://github.com/tuomasjjrasanen/python-uinput/issues>. However, to avoid
+<https://github.com/pyinput/python-uinput/issues>. However, to avoid
duplicate bug reports, before reporting, please check if similar or identical
bug has already been reported. If so, you can still subscribe to the existing
bug to track its progress.
@@ -86,7 +86,7 @@ How to contribute
In addition to reporting bugs and improvement suggestions, you are encouraged to
contribute bug-fixes or features. The source code is maintained in Git and the
main repository is hosted at GitHub,
-<https://github.com/tuomasjjrasanen/python-uinput/>. The preferred way to
+<https://github.com/pyinput/python-uinput/>. The preferred way to
contribute code is to clone the main Git repository and send a pull-request. Good
old patches via email are also accepted.
diff --git a/debian/changelog b/debian/changelog
index d35445b..7d06e90 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+python-uinput (1.0.1-1) unstable; urgency=medium
+
+ * Team upload.
+ * Switch to the official active upstream project.
+ * New upstream release.
+ * debian/watch: Monitor the correct upstream release.
+ * debian/patches: Dropped, merged upstream.
+ * debian/control: Use the new upstream information.
+ * debian/control: Migrate to use pyproject.toml to build the project.
+
+ -- Boyuan Yang <byang@debian.org> Sun, 17 Mar 2024 18:00:59 -0400
+
python-uinput (0.11.3-1) unstable; urgency=medium
* Team upload.
diff --git a/debian/control b/debian/control
index a491881..13e5986 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,8 @@ Uploaders:
Build-Depends:
debhelper-compat (= 13),
dh-sequence-python3,
- pkg-config,
+ pkgconf,
+ pybuild-plugin-pyproject,
python3-all-dev,
python3-setuptools,
Standards-Version: 4.6.2
diff --git a/debian/patches/0001-Migrate-from-distutils-to-setuptools.patch b/debian/patches/0001-Migrate-from-distutils-to-setuptools.patch
deleted file mode 100644
index ad965e8..0000000
--- a/debian/patches/0001-Migrate-from-distutils-to-setuptools.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From: Boyuan Yang <byang@debian.org>
-Date: Sat, 6 Jan 2024 16:00:51 -0500
-Subject: Migrate from distutils to setuptools
-
-Bug: https://github.com/tuomasjjrasanen/python-uinput/issues/46
-Forwarded: https://github.com/selkies-project/python-uinput/pull/1
----
- setup.py | 2 +-
- src/__init__.py | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/setup.py b/setup.py
-index 3fa3343..4900b8b 100644
---- a/setup.py
-+++ b/setup.py
-@@ -3,7 +3,7 @@
- import errno
- import subprocess
-
--from distutils.core import setup, Extension
-+from setuptools import setup, Extension
-
- libudev_so = "libudev.so.1"
-
-diff --git a/src/__init__.py b/src/__init__.py
-index 974c8e1..8efe69c 100644
---- a/src/__init__.py
-+++ b/src/__init__.py
-@@ -36,7 +36,7 @@ from __future__ import absolute_import
- import ctypes
- import errno
- import os
--import distutils.sysconfig as sysconfig
-+import sysconfig
-
- from .ev import *
-
diff --git a/debian/patches/series b/debian/patches/series
deleted file mode 100644
index 0f4576f..0000000
--- a/debian/patches/series
+++ /dev/null
@@ -1 +0,0 @@
-0001-Migrate-from-distutils-to-setuptools.patch
diff --git a/debian/watch b/debian/watch
index 082a1cb..1d77e10 100644
--- a/debian/watch
+++ b/debian/watch
@@ -1,4 +1,4 @@
version=4
opts="filenamemangle=s%.*/@ANY_VERSION@%@PACKAGE@-$1.tar.gz%,searchmode=plain" \
- https://api.github.com/repos/selkies-project/python-uinput/tags?per_page=100 \
- https://api.github.com/repos/selkies-project/python-uinput/tarball/refs/tags/@ANY_VERSION@
+ https://api.github.com/repos/pyinput/python-uinput/tags?per_page=100 \
+ https://api.github.com/repos/pyinput/python-uinput/tarball/refs/tags/@ANY_VERSION@
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..7f23cb6
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,38 @@
+[project]
+name = "python-uinput"
+version = "1.0.1"
+description = "Pythonic API to Linux uinput kernel module."
+authors = [
+ {name = "pyinput"},
+]
+license = {text = "GPLv3+"}
+readme = "README"
+dependencies = []
+requires-python = ">=2.7"
+classifiers = [
+ "Development Status :: 5 - Production/Stable",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: GNU General Public License (GPL)",
+ "Operating System :: POSIX :: Linux",
+ "Topic :: System :: Operating System Kernels :: Linux",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 2",
+ "Programming Language :: Python :: 2.7",
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3.12",
+ ]
+
+
+[project.urls]
+Homepage = "https://github.com/pyinput/python-uinput"
+
+[tool.poetry.dependencies]
+python = ">=2.7"
+
+
+[build-system]
+requires = ["setuptools", "wheel"]
+build-backend = "setuptools.build_meta"
+
+[tool.setuptools]
+package-dir = { "uinput" = "src" }
diff --git a/setup.py b/setup.py
index 3fa3343..3edd833 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,10 @@
import errno
import subprocess
-from distutils.core import setup, Extension
+try:
+ from setuptools import setup, Extension
+except ImportError:
+ from distutils.core import setup, Extension
libudev_so = "libudev.so.1"
@@ -36,30 +39,25 @@ except:
pass
setup(name='python-uinput',
- version='0.11.2',
+ version='1.0.1',
description='Pythonic API to Linux uinput kernel module.',
- author='Tuomas Räsänen',
- author_email='tuomasjjrasanen@tjjr.fi',
- url='http://tjjr.fi/sw/python-uinput/',
+ author='pyinput',
+ url='https://github.com/pyinput/python-uinput',
package_dir={'uinput': 'src'},
packages=['uinput'],
license='GPLv3+',
platforms=['Linux'],
- download_url='http://tjjr.fi/sw/python-uinput/releases/python-uinput-0.11.2.tar.gz',
classifiers=[
- "Development Status :: 4 - Beta",
+ "Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License (GPL)",
"Operating System :: POSIX :: Linux",
"Topic :: System :: Operating System Kernels :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
- "Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.1",
- "Programming Language :: Python :: 3.2",
- "Programming Language :: Python :: 3.4",
+ "Programming Language :: Python :: 3.12",
],
long_description="""
Python-uinput is Python interface to Linux uinput kernel module which
diff --git a/src/__init__.py b/src/__init__.py
index 974c8e1..0a27fde 100644
--- a/src/__init__.py
+++ b/src/__init__.py
@@ -36,7 +36,11 @@ from __future__ import absolute_import
import ctypes
import errno
import os
-import distutils.sysconfig as sysconfig
+try:
+ import sysconfig
+except ImportError:
+ # python < 3.2
+ import distutils.sysconfig as sysconfig
from .ev import *
@@ -83,7 +87,15 @@ def _error_handler(result, fn, args):
def fdopen():
return _libsuinput.suinput_open()
-_libsuinput_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "_libsuinput" + sysconfig.get_config_var("EXT_SUFFIX")))
+def get_libsuinput_path():
+ repo_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
+ # python 2 / 3 compatibility ("SO" is now deprecated)
+ extension = sysconfig.get_config_var("EXT_SUFFIX") or sysconfig.get_config_var("SO")
+ path = os.path.join(repo_dir, "_libsuinput" + extension)
+ return path
+
+
+_libsuinput_path = get_libsuinput_path()
_libsuinput = ctypes.CDLL(_libsuinput_path, use_errno=True)
_libsuinput.suinput_open.errcheck = _open_error_handler
_libsuinput.suinput_enable_event.errcheck = _error_handler
diff --git a/src/ev.py b/src/ev.py
index 7665814..c6053c0 100644
--- a/src/ev.py
+++ b/src/ev.py
@@ -550,6 +550,8 @@ REL_HWHEEL = (0x02, 0x06)
REL_DIAL = (0x02, 0x07)
REL_WHEEL = (0x02, 0x08)
REL_MISC = (0x02, 0x09)
+REL_WHEEL_HI_RES = (0x02, 0x0b)
+REL_HWHEEL_HI_RES = (0x02, 0x0c)
REL_MAX = (0x02, 0x0f)
ABS_X = (0x03, 0x00)
ABS_Y = (0x03, 0x01)
diff --git a/tests/test_uinput.py b/tests/test_uinput.py
new file mode 100644
index 0000000..5dfeb7b
--- /dev/null
+++ b/tests/test_uinput.py
@@ -0,0 +1,23 @@
+import unittest
+
+import uinput
+
+MOUSE_KEYS = [uinput.REL_X, uinput.REL_Y, uinput.BTN_LEFT, uinput.BTN_RIGHT]
+
+class DeviceTest(unittest.TestCase):
+ def test_device_empty(self):
+ with uinput.Device([]) as device:
+ pass
+
+ def test_keyboard_click(self):
+ test_key = uinput.KEY_LEFTCTRL
+ with uinput.Device([test_key]) as device:
+ device.emit_click(test_key)
+
+ def test_mouse_move(self):
+ with uinput.Device(MOUSE_KEYS) as device:
+ device.emit(uinput.REL_X, 1)
+
+
+if __name__ == "__main__":
+ unittest.main()