Clone of official tools
Diff: export/uvision5.py
- Revision:
- 24:25bff2709c20
- Parent:
- 23:fbae331171fa
- Child:
- 29:1210849dba19
--- a/export/uvision5.py Sat Jul 16 22:51:17 2016 +0100 +++ b/export/uvision5.py Mon Aug 01 09:10:17 2016 +0100 @@ -17,7 +17,7 @@ from os.path import basename, join, dirname from project_generator_definitions.definitions import ProGenDef -from tools.export.exporters import Exporter +from tools.export.exporters import Exporter, ExporterTargetsProperty from tools.targets import TARGET_MAP, TARGET_NAMES # If you wish to add a new target, add it to project_generator_definitions, and then @@ -35,23 +35,20 @@ MBED_CONFIG_HEADER_SUPPORTED = True - # backward compatibility with our scripts - def __init__(self): - self._targets = [] - - @property - def TARGETS(self): - if not hasattr(self, "_targets_supported"): - self._targets_supported = [] + @ExporterTargetsProperty + def TARGETS(cls): + if not hasattr(cls, "_targets_supported"): + cls._targets_supported = [] + progendef = ProGenDef('uvision5') for target in TARGET_NAMES: try: - if (ProGenDef('uvision5').is_supported(str(TARGET_MAP[target])) or - ProGenDef('uvision5').is_supported(TARGET_MAP[target].progen['target'])): - self._targets_supported.append(target) + if (progendef.is_supported(str(TARGET_MAP[target])) or + progendef.is_supported(TARGET_MAP[target].progen['target'])): + cls._targets_supported.append(target) except AttributeError: # target is not supported yet continue - return self._targets_supported + return cls._targets_supported def get_toolchain(self): return TARGET_MAP[self.target].default_toolchain