Skip to content

Commit 39f8a7d

Browse files
committed
Create deprecated exporter class decorator
1 parent 1d9fe5e commit 39f8a7d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tools/export/exporters.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ def __init__(self, func):
2525
def __get__(self, inst, cls):
2626
return self.func(cls)
2727

28+
def deprecated_exporter(CLS):
29+
old_init = CLS.__init__
30+
old_name = CLS.NAME
31+
def __init__(*args, **kwargs):
32+
print("==================== DEPRECATION NOTICE ====================")
33+
print("The exporter %s is no longer maintained, and deprecated." % old_name)
34+
print("%s will be removed from mbed OS for the mbed OS 5.6 release." % old_name)
35+
old_init(*args, **kwargs)
36+
CLS.__init__ = __init__
37+
CLS.NAME = "%s (DEPRECATED)" % old_name
38+
return CLS
39+
2840
class Exporter(object):
2941
"""Exporter base class
3042

0 commit comments

Comments
 (0)