diff --git a/core/__init__.py b/core/__init__.py index 13db0b4..5af8516 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 53d020a..3de5e48 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)