Create deprecated exporter class decorator

pull/4824/head
Jimmy Brisson 2017-07-11 11:14:52 -05:00 committed by Martin Kojtal
parent 7af22d0499
commit ccc2105cd1
1 changed files with 12 additions and 0 deletions

View File

@ -25,6 +25,18 @@ class ExporterTargetsProperty(object):
def __get__(self, inst, cls): def __get__(self, inst, cls):
return self.func(cls) return self.func(cls)
def deprecated_exporter(CLS):
old_init = CLS.__init__
old_name = CLS.NAME
def __init__(*args, **kwargs):
print("==================== DEPRECATION NOTICE ====================")
print("The exporter %s is no longer maintained, and deprecated." % old_name)
print("%s will be removed from mbed OS for the mbed OS 5.6 release." % old_name)
old_init(*args, **kwargs)
CLS.__init__ = __init__
CLS.NAME = "%s (DEPRECATED)" % old_name
return CLS
class Exporter(object): class Exporter(object):
"""Exporter base class """Exporter base class