diff --git a/core/__init__.py b/core/__init__.py index 59487ef..da0dc54 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -7,10 +7,11 @@ from . import cmd from . import file from . import misc from . import text -textui = text try: from . import cython_types as types except: aux._print('unable to load C implementation, using python instead', text.prefix.warn) from . import python_types as types + +textui = aux.DeprecationForwarder(text, 'over.core.textui', 'over.core.text') diff --git a/core/aux.py b/core/aux.py index 5059288..61bfa2a 100644 --- a/core/aux.py +++ b/core/aux.py @@ -6,3 +6,13 @@ import sys from . import text _print = text.Output('over.core', stream=sys.stderr) + +class DeprecationForwarder: + def __init__(self, target, old_name, new_name): + self._target = target + self._old_name = old_name + self._new_name = new_name + + def __getattr__(self, name): + _print('%s is deprecated, please use %s instead' %(self._old_name, self._new_name), text.prefix.warn) + return getattr(self._target, name)