14
0
forked from pool/python-evdev

Accepting request 884132 from home:bnavigator:branches:devel:languages:python

- Add evdev-re-Pattern.patch -- gh#gvalkov/python-evdev#152

OBS-URL: https://build.opensuse.org/request/show/884132
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-evdev?expand=0&rev=17
This commit is contained in:
Matthias Bach
2021-04-10 08:46:57 +00:00
committed by Git OBS Bridge
parent 9c2bc907e6
commit 2c64f60f45
3 changed files with 30 additions and 1 deletions

22
evdev-re-Pattern.patch Normal file
View File

@@ -0,0 +1,22 @@
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():

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri Apr 9 20:28:30 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Add evdev-re-Pattern.patch -- gh#gvalkov/python-evdev#152
-------------------------------------------------------------------
Sat Jan 23 01:05:35 UTC 2021 - Dirk Müller <dmueller@suse.com>

View File

@@ -26,6 +26,8 @@ Group: Development/Languages/Python
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 @@ input devices that can inject events directly into the input
subsystem.
%prep
%autosetup
%autosetup -p1
%build
%python_build