Files
FabledSteward/roundtable/__init__.py
T
bvandeusen fad1c12eac feat: fabledscryer→roundtable import alias shim
Meta path finder redirects fabledscryer[.*] imports to roundtable[.*],
keeping unmodified plugin repos working during the rebrand transition.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 17:26:30 -04:00

40 lines
1.2 KiB
Python

__version__ = "0.1.0"
# Compatibility shim: allow `import fabledscryer[.x.y]` to resolve to
# `roundtable[.x.y]`. Lets unmodified plugin repos keep working during the
# rebrand transition. Remove once all plugins migrate to `roundtable`.
import sys as _sys
import importlib as _importlib
import importlib.abc as _abc
import importlib.util as _util
_ALIAS = "fabledscryer"
class _RoundtableAliasLoader(_abc.Loader):
def __init__(self, real_name):
self._real_name = real_name
def create_module(self, spec):
return _importlib.import_module(self._real_name)
def exec_module(self, module):
pass
class _RoundtableAliasFinder(_abc.MetaPathFinder):
def find_spec(self, fullname, path=None, target=None):
if fullname != _ALIAS and not fullname.startswith(_ALIAS + "."):
return None
real_name = "roundtable" + fullname[len(_ALIAS):]
if _util.find_spec(real_name) is None:
return None
return _util.spec_from_loader(
fullname, _RoundtableAliasLoader(real_name)
)
if not any(isinstance(f, _RoundtableAliasFinder) for f in _sys.meta_path):
_sys.meta_path.insert(0, _RoundtableAliasFinder())
_sys.modules.setdefault(_ALIAS, _sys.modules[__name__])