Skip to content

Exporters - progen TARGETS lazy evaluated #2176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions tools/export/iar.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,19 @@ class IAREmbeddedWorkbench(Exporter):

MBED_CONFIG_HEADER_SUPPORTED = True

# backward compatibility with our scripts
TARGETS = []
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'])):
TARGETS.append(target)
except AttributeError:
# target is not supported yet
continue
@property
def TARGETS(self):
if not hasattr(self, "_targets_supported"):
self._targets_supported = []
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)
except AttributeError:
# target is not supported yet
continue
return self._targets_supported

def generate(self):
""" Generates the project files """
Expand Down
23 changes: 13 additions & 10 deletions tools/export/uvision4.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,19 @@ class Uvision4(Exporter):

MBED_CONFIG_HEADER_SUPPORTED = True

# backward compatibility with our scripts
TARGETS = []
for target in TARGET_NAMES:
try:
if (ProGenDef('uvision').is_supported(str(TARGET_MAP[target])) or
ProGenDef('uvision').is_supported(TARGET_MAP[target].progen['target'])):
TARGETS.append(target)
except AttributeError:
# target is not supported yet
continue
@property
def TARGETS(self):
if not hasattr(self, "_targets_supported"):
self._targets_supported = []
for target in TARGET_NAMES:
try:
if (ProGenDef('uvision').is_supported(str(TARGET_MAP[target])) or
ProGenDef('uvision').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):
return TARGET_MAP[self.target].default_toolchain
Expand Down
25 changes: 16 additions & 9 deletions tools/export/uvision5.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,22 @@ class Uvision5(Exporter):
MBED_CONFIG_HEADER_SUPPORTED = True

# backward compatibility with our scripts
TARGETS = []
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'])):
TARGETS.append(target)
except AttributeError:
# target is not supported yet
continue
def __init__(self):
self._targets = []

@property
def TARGETS(self):
if not hasattr(self, "_targets_supported"):
self._targets_supported = []
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)
except AttributeError:
# target is not supported yet
continue
return self._targets_supported

def get_toolchain(self):
return TARGET_MAP[self.target].default_toolchain
Expand Down