Skip to content

Commit 9d1b947

Browse files
authored
Merge pull request #3439 from theotherjimmy/detect-targets-args
Remove unused arguments from detect targets
2 parents 58ed59a + 23461ee commit 9d1b947

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

tools/detect_targets.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"""
1818
import sys
1919
import os
20+
import re
2021

2122
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
2223
sys.path.insert(0, ROOT)
@@ -30,13 +31,14 @@
3031
# Imports related to mbed build api
3132
from tools.build_api import mcu_toolchain_matrix
3233
from tools.test_api import get_autodetected_MUTS_list
34+
from argparse import ArgumentParser
3335

3436

3537
def main():
3638
"""Entry Point"""
3739
try:
3840
# Parse Options
39-
parser = get_default_options_parser()
41+
parser = ArgumentParser()
4042

4143
parser.add_argument("-S", "--supported-toolchains",
4244
action="store_true",
@@ -68,14 +70,17 @@ def main():
6870
# parameters like 'toolchains_filter' are also set.
6971
muts = get_autodetected_MUTS_list()
7072

73+
mcu_filter = options.general_filter_regex or ".*"
74+
7175
count = 0
7276
for mut in muts.values():
73-
print ""
74-
print "[mbed] Detected %s, port %s, mounted %s" % \
75-
(mut['mcu'], mut['port'], mut['disk'])
76-
print "[mbed] Supported toolchains for %s" % mut['mcu']
77-
print mcu_toolchain_matrix(platform_filter=r'^'+mut['mcu']+'$')
78-
count += 1
77+
if re.match(mcu_filter, mut['mcu']):
78+
print ""
79+
print "[mbed] Detected %s, port %s, mounted %s" % \
80+
(mut['mcu'], mut['port'], mut['disk'])
81+
print "[mbed] Supported toolchains for %s" % mut['mcu']
82+
print mcu_toolchain_matrix(platform_filter=mut['mcu'])
83+
count += 1
7984

8085
if count == 0:
8186
print "[mbed] No mbed targets where detected on your system."

0 commit comments

Comments
 (0)