summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2024-05-13 20:26:10 +0300
committerMaxim Devaev <[email protected]>2024-07-19 15:25:14 +0300
commit3d8265e6b97dd692f2147abf7dd0bff6c91b690f (patch)
treea55ea16596d1be3de8265b85fbf15a65882c8831
parente784dc3e70acab049640001449f825c4862441c4 (diff)
fixed deprecated find_module()
-rw-r--r--kvmd/keyboard/keysym.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/kvmd/keyboard/keysym.py b/kvmd/keyboard/keysym.py
index dd311e98..5e80d789 100644
--- a/kvmd/keyboard/keysym.py
+++ b/kvmd/keyboard/keysym.py
@@ -22,6 +22,7 @@
import pkgutil
import functools
+import importlib.util
import importlib.machinery
import Xlib.keysymdef
@@ -87,10 +88,11 @@ def _get_keysyms() -> dict[str, int]:
for (finder, module_name, _) in pkgutil.walk_packages(Xlib.keysymdef.__path__):
if not isinstance(finder, importlib.machinery.FileFinder):
continue
- loader = finder.find_module(module_name)
- if loader is None:
+ spec = finder.find_spec(module_name)
+ if spec is None or spec.loader is None:
continue
- module = loader.load_module(module_name)
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
for keysym_name in dir(module):
if keysym_name.startswith("XK_"):
short_name = keysym_name[3:]