1717from os .path import basename , join , dirname
1818from project_generator_definitions .definitions import ProGenDef
1919
20- from tools .export .exporters import Exporter
20+ from tools .export .exporters import Exporter , ExporterTargetsProperty
2121from tools .targets import TARGET_MAP , TARGET_NAMES
2222from tools .settings import ARM_INC
2323
@@ -36,23 +36,19 @@ class Uvision5(Exporter):
3636
3737 MBED_CONFIG_HEADER_SUPPORTED = True
3838
39- # backward compatibility with our scripts
40- def __init__ (self ):
41- self ._targets = []
42-
43- @property
44- def TARGETS (self ):
45- if not hasattr (self , "_targets_supported" ):
46- self ._targets_supported = []
39+ @ExporterTargetsProperty
40+ def TARGETS (cls ):
41+ if not hasattr (cls , "_targets_supported" ):
42+ cls ._targets_supported = []
4743 for target in TARGET_NAMES :
4844 try :
4945 if (ProGenDef ('uvision5' ).is_supported (str (TARGET_MAP [target ])) or
5046 ProGenDef ('uvision5' ).is_supported (TARGET_MAP [target ].progen ['target' ])):
51- self ._targets_supported .append (target )
47+ cls ._targets_supported .append (target )
5248 except AttributeError :
5349 # target is not supported yet
5450 continue
55- return self ._targets_supported
51+ return cls ._targets_supported
5652
5753 def get_toolchain (self ):
5854 return TARGET_MAP [self .target ].default_toolchain
0 commit comments