Merge branch 'master' of git.covalent.cz:overwatch/over

This commit is contained in:
Martinez 2015-06-08 20:49:23 +02:00
commit 20393b74ff
2 changed files with 12 additions and 1 deletions

View file

@ -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')

View file

@ -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)