Skip to content

Commit 7b3ef21

Browse files
committed
Make mcu and tool arguments many and update all consumers of them
1 parent d757f35 commit 7b3ef21

File tree

4 files changed

+10
-18
lines changed

4 files changed

+10
-18
lines changed

tools/build.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,10 @@
159159
exit(0)
160160

161161
# Get target list
162-
if options.mcu:
163-
mcu_list = (options.mcu).split(",")
164-
targets = mcu_list
165-
else:
166-
targets = TARGET_NAMES
162+
targets = options.mcu if options.mcu else TARGET_NAMES
167163

168164
# Get toolchains list
169-
if options.tool:
170-
toolchain_list = (options.tool).split(",")
171-
toolchains = toolchain_list
172-
else:
173-
toolchains = TOOLCHAINS
165+
toolchains = options.tool if options.tool else TOOLCHAINS
174166

175167
# Get libraries list
176168
libraries = []

tools/make.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,12 @@
204204
# Target
205205
if options.mcu is None :
206206
args_error(parser, "[ERROR] You should specify an MCU")
207-
mcu = options.mcu
207+
mcu = options.mcu[0]
208208

209209
# Toolchain
210210
if options.tool is None:
211211
args_error(parser, "[ERROR] You should specify a TOOLCHAIN")
212-
toolchain = options.tool
212+
toolchain = options.tool[0]
213213

214214
# Test
215215
for test_no in p:

tools/options.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from argparse import ArgumentParser
1818
from tools.toolchains import TOOLCHAINS
1919
from tools.targets import TARGET_NAMES
20-
from utils import argparse_uppercase_type, argparse_lowercase_hyphen_type
20+
from utils import argparse_uppercase_type, argparse_lowercase_hyphen_type, argparse_many
2121

2222

2323
def get_default_options_parser(add_clean=True, add_options=True):
@@ -31,12 +31,12 @@ def get_default_options_parser(add_clean=True, add_options=True):
3131
parser.add_argument("-m", "--mcu",
3232
help="build for the given MCU (%s)" % ', '.join(targetnames),
3333
metavar="MCU",
34-
type=argparse_uppercase_type(targetnames, "MCU"))
34+
type=argparse_many(argparse_uppercase_type(targetnames, "MCU")))
3535

3636
parser.add_argument("-t", "--tool",
3737
help="build using the given TOOLCHAIN (%s)" % ', '.join(toolchainlist),
3838
metavar="TOOLCHAIN",
39-
type=argparse_uppercase_type(toolchainlist, "toolchain"))
39+
type=argparse_many(argparse_uppercase_type(toolchainlist, "toolchain")))
4040

4141
if add_clean:
4242
parser.add_argument("-c", "--clean", action="store_true", default=False,

tools/test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,15 @@
137137
base_source_paths = ['.']
138138

139139

140-
target = TARGET_MAP[options.mcu]
140+
target = TARGET_MAP[options.mcu[0]]
141141

142142
build_report = {}
143143
build_properties = {}
144144

145145
library_build_success = False
146146
try:
147147
# Build sources
148-
build_library(base_source_paths, options.build_dir, target, options.tool,
148+
build_library(base_source_paths, options.build_dir, target, options.tool[0],
149149
options=options.options,
150150
jobs=options.jobs,
151151
clean=options.clean,
@@ -171,7 +171,7 @@
171171
print "Failed to build library"
172172
else:
173173
# Build all the tests
174-
test_build_success, test_build = build_tests(tests, [options.build_dir], options.build_dir, target, options.tool,
174+
test_build_success, test_build = build_tests(tests, [options.build_dir], options.build_dir, target, options.tool[0],
175175
options=options.options,
176176
clean=options.clean,
177177
report=build_report,

0 commit comments

Comments
 (0)