Skip to content

Commit b56a7a6

Browse files
committed
Move exporter alias handling into CLI
1 parent f12afde commit b56a7a6

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

tools/export/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434

3535
EXPORTERS = {
3636
u'uvision5': uvision.Uvision,
37-
u'uvision': uvision.Uvision,
38-
u'gcc_arm': makefile.GccArm,
3937
u'make_gcc_arm': makefile.GccArm,
4038
u'make_armc5': makefile.Armc5,
4139
u'make_armc6': makefile.Armc6,

tools/project.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@
2828
from tools.options import extract_profile, list_profiles, extract_mcus
2929
from tools.notifier.term import TerminalNotifier
3030

31+
EXPORTER_ALIASES = {
32+
u'gcc_arm': u'make_gcc_arm',
33+
u'uvision': u'uvision5',
34+
}
35+
36+
37+
def resolve_exporter_alias(ide):
38+
if ide in EXPORTER_ALIASES:
39+
return EXPORTER_ALIASES[ide]
40+
else:
41+
return ide
42+
43+
3144
def setup_project(ide, target, program=None, source_dir=None, build=None, export_path=None):
3245
"""Generate a name, if not provided, and find dependencies
3346
@@ -109,7 +122,7 @@ def main():
109122

110123
targetnames = TARGET_NAMES
111124
targetnames.sort()
112-
toolchainlist = list(EXPORTERS.keys())
125+
toolchainlist = list(EXPORTERS.keys() + EXPORTER_ALIASES.keys())
113126
toolchainlist.sort()
114127

115128
parser.add_argument("-m", "--mcu",
@@ -256,10 +269,11 @@ def main():
256269

257270
if (options.program is None) and (not options.source_dir):
258271
args_error(parser, "one of -p, -n, or --source is required")
259-
exporter, toolchain_name = get_exporter_toolchain(options.ide)
272+
ide = resolve_exporter_alias(options.ide)
273+
exporter, toolchain_name = get_exporter_toolchain(ide)
260274
mcu = extract_mcus(parser, options)[0]
261275
if not exporter.is_target_supported(mcu):
262-
args_error(parser, "%s not supported by %s"%(mcu,options.ide))
276+
args_error(parser, "%s not supported by %s" % (mcu, ide))
263277
profile = extract_profile(parser, options, toolchain_name, fallback="debug")
264278
if options.clean:
265279
for cls in EXPORTERS.values():
@@ -273,7 +287,7 @@ def main():
273287
except (IOError, OSError):
274288
pass
275289
try:
276-
export(mcu, options.ide, build=options.build,
290+
export(mcu, ide, build=options.build,
277291
src=options.source_dir, macros=options.macros,
278292
project_id=options.program, zip_proj=zip_proj,
279293
build_profile=profile, app_config=options.app_config,

0 commit comments

Comments
 (0)