Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-evdev for openSUSE:Factory checked in at 2021-04-12 12:36:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-evdev (Old) and /work/SRC/openSUSE:Factory/.python-evdev.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-evdev" Mon Apr 12 12:36:56 2021 rev:8 rq:884194 version:1.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-evdev/python-evdev.changes 2021-01-01 21:14:07.735414066 +0100 +++ /work/SRC/openSUSE:Factory/.python-evdev.new.2401/python-evdev.changes 2021-04-12 12:39:48.169539341 +0200 @@ -1,0 +2,19 @@ +Fri Apr 9 20:28:30 UTC 2021 - Ben Greiner <c...@bnavigator.de> + +- Add evdev-re-Pattern.patch -- gh#gvalkov/python-evdev#152 + +------------------------------------------------------------------- +Sat Jan 23 01:05:35 UTC 2021 - Dirk M??ller <dmuel...@suse.com> + +- update to 1.4.0: +- Fix ``InputDevice.set_absinfo`` to allow setting parameters to zero. +- Fix off-by-one in ``ioctl_EVIOCG_bits``, which causes value at the end of the + list to not be reported back +- Fix ``set_absinfo`` to allow setting parameters to zero +- Fix leak when returning ``BlockingIOError`` from a read +- Fix "There is no current event loop in thread" error for non asyncio code +- Prevent ``InputDevice`` destructor from blocking +- Add missing return codes to ``os.strerror()`` calls and fix force feedback +- Add the ``util.find_ecodes_by_regex()`` helper function. + +------------------------------------------------------------------- Old: ---- v1.3.0.tar.gz New: ---- evdev-re-Pattern.patch v1.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-evdev.spec ++++++ --- /var/tmp/diff_new_pack.KKk83r/_old 2021-04-12 12:39:48.669539922 +0200 +++ /var/tmp/diff_new_pack.KKk83r/_new 2021-04-12 12:39:48.673539927 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-evdev # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define modname evdev Name: python-evdev -Version: 1.3.0 +Version: 1.4.0 Release: 0 Summary: Python bindings to the Linux input handling subsystem License: BSD-3-Clause @@ -26,6 +26,8 @@ URL: https://github.com/gvalkov/python-evdev # Source needs to be pulled form Github as the source distribution on PyPI lacks the test directory Source: https://github.com/gvalkov/python-evdev/archive/v%{version}.tar.gz +# PATCH-FIX-UPSTREAM evdev-re-Pattern.patch -- gh#gvalkov/python-evdev#152 +Patch1: evdev-re-Pattern.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} @@ -45,7 +47,7 @@ subsystem. %prep -%autosetup +%autosetup -p1 %build %python_build ++++++ evdev-re-Pattern.patch ++++++ diff --git a/evdev/util.py b/evdev/util.py index 818be69..e8009f7 100644 --- a/evdev/util.py +++ b/evdev/util.py @@ -118,6 +118,8 @@ def find_ecodes_by_regex(regex): ''' Find ecodes matching a regex and return a mapping of event type to event codes. + regex can be a pattern string or a compiled regular expression object. + Example ------- >>> find_ecodes_by_regex(r'(ABS|KEY)_BR(AKE|EAK)') @@ -130,7 +132,7 @@ def find_ecodes_by_regex(regex): } ''' - regex = regex if isinstance(regex, re.Pattern) else re.compile(regex) + regex = re.compile(regex) # re.compile is idempotent result = collections.defaultdict(list) for type_code, codes in ecodes.bytype.items(): ++++++ v1.3.0.tar.gz -> v1.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.3.0/docs/changelog.rst new/python-evdev-1.4.0/docs/changelog.rst --- old/python-evdev-1.3.0/docs/changelog.rst 2020-01-12 00:41:29.000000000 +0100 +++ new/python-evdev-1.4.0/docs/changelog.rst 2021-01-16 14:50:51.000000000 +0100 @@ -1,6 +1,31 @@ Changelog --------- + +1.4.0 (Jan 16, 2021) +==================== + +- Fix ``InputDevice.set_absinfo`` to allow setting parameters to zero. + +- Fix off-by-one in ``ioctl_EVIOCG_bits``, which causes value at the end of the + list to not be reported back (`#131 <https://github.com/gvalkov/python-evdev/pull/131>`_). + +- Fix ``set_absinfo`` to allow setting parameters to zero (`#128 <https://github.com/gvalkov/python-evdev/pull/128>`_). + +- Fix leak when returning ``BlockingIOError`` from a read (`#143 <https://github.com/gvalkov/python-evdev/pull/143>`_). + +- Fix "There is no current event loop in thread" error for non asyncio code + (`#146 <https://github.com/gvalkov/python-evdev/pull/146>`_). + +- Prevent ``InputDevice`` destructor from blocking (`#145 <https://github.com/gvalkov/python-evdev/pull/145>`_). + +- Add missing return codes to ``os.strerror()`` calls and fix force feedback + example in docs (`#138 <https://github.com/gvalkov/python-evdev/pull/137>`_). + +- Add the ``util.find_ecodes_by_regex()`` helper function. + + + 1.3.0 (Jan 12, 2020) ==================== @@ -383,9 +408,9 @@ .. _`@paulo-raca`: https://github.com/paulo-raca .. _`@ndreys`: https://github.com/ndreys .. _`@LinusCDE`: https://github.com/gvalkov/python-evdev/pulls/LinusCDE -.. _`ivaradi`: https://github.com/gvalkov/python-evdev/pull/104 +.. _`@ivaradi`: https://github.com/gvalkov/python-evdev/pull/104 .. _`introduced in Linux 4.5`: https://github.com/torvalds/linux/commit/052876f8e5aec887d22c4d06e54aa5531ffcec75 .. _issue21121: http://bugs.python.org/issue21121 .. _`#63`: https://github.com/gvalkov/python-evdev/issues/63 -.. _`#63`: https://github.com/gvalkov/python-evdev/issues/67 +.. _`#67`: https://github.com/gvalkov/python-evdev/issues/67 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.3.0/docs/conf.py new/python-evdev-1.4.0/docs/conf.py --- old/python-evdev-1.3.0/docs/conf.py 2020-01-12 00:41:29.000000000 +0100 +++ new/python-evdev-1.4.0/docs/conf.py 2021-01-16 14:50:51.000000000 +0100 @@ -60,7 +60,7 @@ # built documents. # # The full version, including alpha/beta/rc tags. -release = '1.3.0' +release = '1.4.0' # The short X.Y version. version = release diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.3.0/docs/scope.rst new/python-evdev-1.4.0/docs/scope.rst --- old/python-evdev-1.3.0/docs/scope.rst 2020-01-12 00:41:29.000000000 +0100 +++ new/python-evdev-1.4.0/docs/scope.rst 2021-01-16 14:50:51.000000000 +0100 @@ -18,13 +18,13 @@ - python-uinput_ - uinput-mapper_ -- PyUserInput_ (cross-platform, works on the display server level) +- pynput_ - pygame_ (cross-platform) .. _python-uinput: https://github.com/tuomasjjrasanen/python-uinput .. _uinput-mapper: https://github.com/MerlijnWajer/uinput-mapper -.. _PyUserInput: https://github.com/PyUserInput/PyUserInput +.. _pynput: https://github.com/moses-palmer/pynput .. _pygame: http://www.pygame.org/ .. _`#7`: https://github.com/gvalkov/python-evdev/issues/7 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.3.0/docs/tutorial.rst new/python-evdev-1.4.0/docs/tutorial.rst --- old/python-evdev-1.3.0/docs/tutorial.rst 2020-01-12 00:41:29.000000000 +0100 +++ new/python-evdev-1.4.0/docs/tutorial.rst 2021-01-16 14:50:51.000000000 +0100 @@ -253,6 +253,20 @@ ... ['KEY_COFFEE', 'KEY_SCREENLOCK'] +Searching event codes by regex +============================== + +:: + + >>> from evdev import util + + >>> res = util.find_ecodes_by_regex(r'(ABS|KEY)_BR(AKE|EAK)') + >>> res + ... {1: [411], 3: [10]} + >>> util.resolve_ecodes_dict(res) + ... {('EV_KEY', 1): [('KEY_BREAK', 411)], ('EV_ABS', 3): [('ABS_BRAKE', 10)]} + + Getting exclusive access to a device ==================================== @@ -385,13 +399,13 @@ # Wait for an EV_UINPUT event that will signal us that an # effect upload/erase operation is in progress. if event.type != ecodes.EV_UINPUT: - pass + continue if event.code == ecodes.UI_FF_UPLOAD: upload = device.begin_upload(event.value) upload.retval = 0 - print(f'[upload] effect_id: {upload.effect_id}, type: {upload.effect.type}') + print(f'[upload] effect_id: {upload.effect.id}, type: {upload.effect.type}') device.end_upload(upload) elif event.code == ecodes.UI_FF_ERASE: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.3.0/evdev/device.py new/python-evdev-1.4.0/evdev/device.py --- old/python-evdev-1.3.0/evdev/device.py 2020-01-12 00:41:29.000000000 +0100 +++ new/python-evdev-1.4.0/evdev/device.py 2021-01-16 14:50:51.000000000 +0100 @@ -4,6 +4,7 @@ import warnings import contextlib import collections +import threading from evdev import _input, ecodes, util from evdev.events import InputEvent @@ -302,7 +303,9 @@ if self.fd > -1: try: super().close() - os.close(self.fd) + # avoid blocking at the end of functions when the destructor + # is called. + threading.Thread(target=os.close, args=(self.fd,)).start() finally: self.fd = -1 @@ -435,10 +438,10 @@ ''' cur_absinfo = self.absinfo(axis_num) - new_absinfo = AbsInfo(value if value else cur_absinfo.value, - min if min else cur_absinfo.min, - max if max else cur_absinfo.max, - fuzz if fuzz else cur_absinfo.fuzz, - flat if flat else cur_absinfo.flat, - resolution if resolution else cur_absinfo.resolution) + new_absinfo = AbsInfo(value if value is not None else cur_absinfo.value, + min if min is not None else cur_absinfo.min, + max if max is not None else cur_absinfo.max, + fuzz if fuzz is not None else cur_absinfo.fuzz, + flat if flat is not None else cur_absinfo.flat, + resolution if resolution is not None else cur_absinfo.resolution) _input.ioctl_EVIOCSABS(self.fd, axis_num, new_absinfo) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.3.0/evdev/eventio_async.py new/python-evdev-1.4.0/evdev/eventio_async.py --- old/python-evdev-1.3.0/evdev/eventio_async.py 2020-01-12 00:41:29.000000000 +0100 +++ new/python-evdev-1.4.0/evdev/eventio_async.py 2021-01-16 14:50:51.000000000 +0100 @@ -51,8 +51,13 @@ return ReadIterator(self) def close(self): - loop = asyncio.get_event_loop() - loop.remove_reader(self.fileno()) + try: + loop = asyncio.get_event_loop() + loop.remove_reader(self.fileno()) + except RuntimeError: + # no event loop present, so there is nothing to + # remove the reader from. Ignore + pass class ReadIterator(object): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.3.0/evdev/ff.py new/python-evdev-1.4.0/evdev/ff.py --- old/python-evdev-1.3.0/evdev/ff.py 2020-01-12 00:41:29.000000000 +0100 +++ new/python-evdev-1.4.0/evdev/ff.py 2021-01-16 14:50:51.000000000 +0100 @@ -51,7 +51,7 @@ ''' _fields_ = [ - ('attach_length', _u16), + ('attack_length', _u16), ('attack_level', _u16), ('fade_length', _u16), ('fade_level', _u16), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.3.0/evdev/input.c new/python-evdev-1.4.0/evdev/input.c --- old/python-evdev-1.3.0/evdev/input.c 2020-01-12 00:41:29.000000000 +0100 +++ new/python-evdev-1.4.0/evdev/input.c 2021-01-16 14:50:51.000000000 +0100 @@ -102,6 +102,7 @@ if (nread < 0) { PyErr_SetFromErrno(PyExc_IOError); + Py_DECREF(event_list); return NULL; } @@ -413,7 +414,7 @@ return NULL; PyObject* res = PyList_New(0); - for (int i=0; i<max; i++) { + for (int i=0; i<=max; i++) { if (test_bit(bytes, i)) { PyList_Append(res, Py_BuildValue("i", i)); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.3.0/evdev/uinput.py new/python-evdev-1.4.0/evdev/uinput.py --- old/python-evdev-1.3.0/evdev/uinput.py 2020-01-12 00:41:29.000000000 +0100 +++ new/python-evdev-1.4.0/evdev/uinput.py 2021-01-16 14:50:51.000000000 +0100 @@ -229,26 +229,30 @@ upload = ff.UInputUpload() upload.effect_id = effect_id - if self.dll._uinput_begin_upload(self.fd, ctypes.byref(upload)): - raise UInputError('Failed to begin uinput upload: ' + os.strerror()) + ret = self.dll._uinput_begin_upload(self.fd, ctypes.byref(upload)) + if ret: + raise UInputError('Failed to begin uinput upload: ' + os.strerror(ret)) return upload def end_upload(self, upload): - if self.dll._uinput_end_upload(self.fd, ctypes.byref(upload)): - raise UInputError('Failed to end uinput upload: ' + os.strerror()) + ret = self.dll._uinput_end_upload(self.fd, ctypes.byref(upload)) + if ret: + raise UInputError('Failed to end uinput upload: ' + os.strerror(ret)) def begin_erase(self, effect_id): erase = ff.UInputErase() erase.effect_id = effect_id - if self.dll._uinput_begin_erase(self.fd, ctypes.byref(erase)): - raise UInputError('Failed to begin uinput erase: ' + os.strerror()) + ret = self.dll._uinput_begin_erase(self.fd, ctypes.byref(erase)) + if ret: + raise UInputError('Failed to begin uinput erase: ' + os.strerror(ret)) return erase def end_erase(self, erase): - if self.dll._uinput_end_erase(self.fd, ctypes.byref(erase)): - raise UInputError('Failed to end uinput erase: ' + os.strerror()) + ret = self.dll._uinput_end_erase(self.fd, ctypes.byref(erase)) + if ret: + raise UInputError('Failed to end uinput erase: ' + os.strerror(ret)) def _verify(self): ''' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.3.0/evdev/util.py new/python-evdev-1.4.0/evdev/util.py --- old/python-evdev-1.3.0/evdev/util.py 2020-01-12 00:41:29.000000000 +0100 +++ new/python-evdev-1.4.0/evdev/util.py 2021-01-16 14:50:51.000000000 +0100 @@ -1,8 +1,10 @@ # encoding: utf-8 +import re import os import stat import glob +import collections from evdev import ecodes from evdev.events import event_factory @@ -89,8 +91,8 @@ Example ------- - >>> resolve_ecodes([272, 273, 274]) - [('BTN_MOUSE', 272), ('BTN_RIGHT', 273), ('BTN_MIDDLE', 274)] + >>> resolve_ecodes(ecodes.BTN, [272, 273, 274]) + [(['BTN_LEFT', 'BTN_MOUSE'], 272), ('BTN_RIGHT', 273), ('BTN_MIDDLE', 274)] ''' res = [] for ecode in ecode_list: @@ -112,4 +114,34 @@ return res -__all__ = ('list_devices', 'is_device', 'categorize', 'resolve_ecodes', 'resolve_ecodes_dict') +def find_ecodes_by_regex(regex): + ''' + Find ecodes matching a regex and return a mapping of event type to event codes. + + Example + ------- + >>> find_ecodes_by_regex(r'(ABS|KEY)_BR(AKE|EAK)') + {1: [411], 3: [10]} + >>> res = find_ecodes_by_regex(r'(ABS|KEY)_BR(AKE|EAK)') + >>> resolve_ecodes_dict(res) + { + ('EV_KEY', 1): [('KEY_BREAK', 411)], + ('EV_ABS', 3): [('ABS_BRAKE', 10)] + } + ''' + + regex = regex if isinstance(regex, re.Pattern) else re.compile(regex) + result = collections.defaultdict(list) + + for type_code, codes in ecodes.bytype.items(): + for code, names in codes.items(): + names = (names,) if isinstance(names, str) else names + for name in names: + if regex.match(name): + result[type_code].append(code) + break + + return dict(result) + + +__all__ = ('list_devices', 'is_device', 'categorize', 'resolve_ecodes', 'resolve_ecodes_dict', 'find_ecodes_by_regex') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.3.0/requirements-dev.txt new/python-evdev-1.4.0/requirements-dev.txt --- old/python-evdev-1.3.0/requirements-dev.txt 2020-01-12 00:41:29.000000000 +0100 +++ new/python-evdev-1.4.0/requirements-dev.txt 2021-01-16 14:50:51.000000000 +0100 @@ -2,3 +2,4 @@ Sphinx>=1.7.0 bump2version sphinx_rtd_theme +twine diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.3.0/setup.cfg new/python-evdev-1.4.0/setup.cfg --- old/python-evdev-1.3.0/setup.cfg 2020-01-12 00:41:29.000000000 +0100 +++ new/python-evdev-1.4.0/setup.cfg 2021-01-16 14:50:51.000000000 +0100 @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.3.0 +current_version = 1.4.0 message = Bump version: {current_version} -> {new_version} commit = True tag = True @@ -11,4 +11,3 @@ [bumpversion:file:setup.py] [bumpversion:file:docs/conf.py] - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.3.0/setup.py new/python-evdev-1.4.0/setup.py --- old/python-evdev-1.3.0/setup.py 2020-01-12 00:41:29.000000000 +0100 +++ new/python-evdev-1.4.0/setup.py 2021-01-16 14:50:51.000000000 +0100 @@ -44,7 +44,7 @@ #----------------------------------------------------------------------------- kw = { 'name': 'evdev', - 'version': '1.3.0', + 'version': '1.4.0', 'description': 'Bindings to the Linux input handling subsystem', 'long_description': open(pjoin(here, 'README.rst')).read(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-evdev-1.3.0/tests/test_util.py new/python-evdev-1.4.0/tests/test_util.py --- old/python-evdev-1.3.0/tests/test_util.py 1970-01-01 01:00:00.000000000 +0100 +++ new/python-evdev-1.4.0/tests/test_util.py 2021-01-16 14:50:51.000000000 +0100 @@ -0,0 +1,21 @@ +from evdev import util + + +def test_match_ecodes_a(): + res = util.find_ecodes_by_regex('KEY_ZOOM.*') + assert res == {1: [372, 418, 419, 420]} + assert dict(util.resolve_ecodes_dict(res)) == { + ('EV_KEY', 1): [ + (['KEY_FULL_SCREEN', 'KEY_ZOOM'], 372), + ('KEY_ZOOMIN', 418), + ('KEY_ZOOMOUT', 419), + ('KEY_ZOOMRESET', 420) + ] + } + + res = util.find_ecodes_by_regex(r'(ABS|KEY)_BR(AKE|EAK)') + assert res == {1: [411], 3: [10]} + assert dict(util.resolve_ecodes_dict(res)) == { + ('EV_KEY', 1): [('KEY_BREAK', 411)], + ('EV_ABS', 3): [('ABS_BRAKE', 10)] + }