9578053 Jan 22 2022 distfiles.gentoo.org/distfiles/gajim-1.3.3-2.tar.gz

This commit is contained in:
emdee 2022-10-19 18:09:31 +00:00
parent a5b3822651
commit 4c1b226bff
1045 changed files with 753037 additions and 18 deletions

54
gajim/gui/__init__.py Normal file
View file

@ -0,0 +1,54 @@
import sys
from importlib.abc import MetaPathFinder
from importlib.util import spec_from_file_location
from pathlib import Path
class GUIFinder(MetaPathFinder):
def __init__(self, name, fallback=None):
self._path = Path(__file__).parent.parent / name
self._fallback_path = None
if fallback is not None:
self._fallback_path = Path(__file__).parent.parent / fallback
def find_spec(self, fullname, _path, _target=None):
if not fullname.startswith('gajim.gui'):
return None
_namespace, module_name = fullname.rsplit('.', 1)
module_path = self._find_module(module_name)
if module_path is None:
return None
spec = spec_from_file_location(fullname, module_path)
return spec
def _find_module(self, module_name):
module_path = self._path / f'{module_name}.py'
if module_path.exists():
return module_path
module_path = self._path / f'{module_name}.pyc'
if module_path.exists():
return module_path
if self._fallback_path is None:
return None
module_path = self._fallback_path / f'{module_name}.py'
if module_path.exists():
return module_path
module_path = self._fallback_path / f'{module_name}.pyc'
if module_path.exists():
return module_path
return None
def init(name, fallback=None):
sys.meta_path.append(GUIFinder(name, fallback=fallback))