diff options
author | Maxim Devaev <[email protected]> | 2024-05-13 20:26:10 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2024-05-13 20:28:16 +0300 |
commit | 78898ba325013de0d7ef3e55c8644cf8b6d46244 (patch) | |
tree | 5542597c371b895a6d750d09ebb9ae7463e5d70e | |
parent | 3a13f83fbb519b370534b51b86a39e2ee9852090 (diff) |
fixed deprecated find_module()
-rw-r--r-- | kvmd/keyboard/keysym.py | 8 |
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:] |