diff --git a/evdev-re-Pattern.patch b/evdev-re-Pattern.patch new file mode 100644 index 0000000..9fc4b87 --- /dev/null +++ b/evdev-re-Pattern.patch @@ -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(): diff --git a/python-evdev.changes b/python-evdev.changes index 0b803ef..69ccd79 100644 --- a/python-evdev.changes +++ b/python-evdev.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Apr 9 20:28:30 UTC 2021 - Ben Greiner + +- Add evdev-re-Pattern.patch -- gh#gvalkov/python-evdev#152 + ------------------------------------------------------------------- Sat Jan 23 01:05:35 UTC 2021 - Dirk Müller diff --git a/python-evdev.spec b/python-evdev.spec index 88bbcef..5451c42 100644 --- a/python-evdev.spec +++ b/python-evdev.spec @@ -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