Merge pull request #2176 from 0xc0170/fix_#2171

Exporters - progen TARGETS lazy evaluated
pull/2185/head
Martin Kojtal 2016-07-15 23:55:48 +01:00 committed by GitHub
commit 7251a8ccae
3 changed files with 42 additions and 29 deletions

View File

@ -35,16 +35,19 @@ class IAREmbeddedWorkbench(Exporter):
MBED_CONFIG_HEADER_SUPPORTED = True MBED_CONFIG_HEADER_SUPPORTED = True
# backward compatibility with our scripts @property
TARGETS = [] def TARGETS(self):
for target in TARGET_NAMES: if not hasattr(self, "_targets_supported"):
try: self._targets_supported = []
if (ProGenDef('iar').is_supported(str(TARGET_MAP[target])) or for target in TARGET_NAMES:
ProGenDef('iar').is_supported(TARGET_MAP[target].progen['target'])): try:
TARGETS.append(target) if (ProGenDef('iar').is_supported(str(TARGET_MAP[target])) or
except AttributeError: ProGenDef('iar').is_supported(TARGET_MAP[target].progen['target'])):
# target is not supported yet self._targets_supported.append(target)
continue except AttributeError:
# target is not supported yet
continue
return self._targets_supported
def generate(self): def generate(self):
""" Generates the project files """ """ Generates the project files """

View File

@ -36,16 +36,19 @@ class Uvision4(Exporter):
MBED_CONFIG_HEADER_SUPPORTED = True MBED_CONFIG_HEADER_SUPPORTED = True
# backward compatibility with our scripts @property
TARGETS = [] def TARGETS(self):
for target in TARGET_NAMES: if not hasattr(self, "_targets_supported"):
try: self._targets_supported = []
if (ProGenDef('uvision').is_supported(str(TARGET_MAP[target])) or for target in TARGET_NAMES:
ProGenDef('uvision').is_supported(TARGET_MAP[target].progen['target'])): try:
TARGETS.append(target) if (ProGenDef('uvision').is_supported(str(TARGET_MAP[target])) or
except AttributeError: ProGenDef('uvision').is_supported(TARGET_MAP[target].progen['target'])):
# target is not supported yet self._targets_supported.append(target)
continue except AttributeError:
# target is not supported yet
continue
return self._targets_supported
def get_toolchain(self): def get_toolchain(self):
return TARGET_MAP[self.target].default_toolchain return TARGET_MAP[self.target].default_toolchain

View File

@ -37,15 +37,22 @@ class Uvision5(Exporter):
MBED_CONFIG_HEADER_SUPPORTED = True MBED_CONFIG_HEADER_SUPPORTED = True
# backward compatibility with our scripts # backward compatibility with our scripts
TARGETS = [] def __init__(self):
for target in TARGET_NAMES: self._targets = []
try:
if (ProGenDef('uvision5').is_supported(str(TARGET_MAP[target])) or @property
ProGenDef('uvision5').is_supported(TARGET_MAP[target].progen['target'])): def TARGETS(self):
TARGETS.append(target) if not hasattr(self, "_targets_supported"):
except AttributeError: self._targets_supported = []
# target is not supported yet for target in TARGET_NAMES:
continue 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)
except AttributeError:
# target is not supported yet
continue
return self._targets_supported
def get_toolchain(self): def get_toolchain(self):
return TARGET_MAP[self.target].default_toolchain return TARGET_MAP[self.target].default_toolchain