Clone of official tools

Revision:
24:25bff2709c20
Parent:
23:fbae331171fa
--- a/export/iar.py	Sat Jul 16 22:51:17 2016 +0100
+++ b/export/iar.py	Mon Aug 01 09:10:17 2016 +0100
@@ -18,7 +18,7 @@
 import os
 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,19 +35,20 @@
 
     MBED_CONFIG_HEADER_SUPPORTED = True
 
-    @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('iar')
             for target in TARGET_NAMES:
                 try:
-                    if (ProGenDef('iar').is_supported(str(TARGET_MAP[target])) or
-                        ProGenDef('iar').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 generate(self, progen_build=False):
         """ Generates the project files """