mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #299 from ARMmbed/detect-targets
Generic text improvements in detect_targets.py
commit
364818f789
|
@ -668,12 +668,12 @@ def mcu_toolchain_matrix(verbose_html=False, platform_filter=None):
|
|||
from prettytable import PrettyTable # Only use it in this function so building works without extra modules
|
||||
|
||||
# All tests status table print
|
||||
columns = ["Platform"] + unique_supported_toolchains
|
||||
pt = PrettyTable(["Platform"] + unique_supported_toolchains)
|
||||
columns = ["Target"] + unique_supported_toolchains
|
||||
pt = PrettyTable(["Target"] + unique_supported_toolchains)
|
||||
# Align table
|
||||
for col in columns:
|
||||
pt.align[col] = "c"
|
||||
pt.align["Platform"] = "l"
|
||||
pt.align["Target"] = "l"
|
||||
|
||||
perm_counter = 0
|
||||
target_counter = 0
|
||||
|
@ -685,25 +685,21 @@ def mcu_toolchain_matrix(verbose_html=False, platform_filter=None):
|
|||
target_counter += 1
|
||||
|
||||
row = [target] # First column is platform name
|
||||
default_toolchain = TARGET_MAP[target].default_toolchain
|
||||
for unique_toolchain in unique_supported_toolchains:
|
||||
text = "-"
|
||||
if default_toolchain == unique_toolchain:
|
||||
text = "Default"
|
||||
perm_counter += 1
|
||||
elif unique_toolchain in TARGET_MAP[target].supported_toolchains:
|
||||
if unique_toolchain in TARGET_MAP[target].supported_toolchains:
|
||||
text = "Supported"
|
||||
perm_counter += 1
|
||||
else:
|
||||
text = "-"
|
||||
|
||||
row.append(text)
|
||||
pt.add_row(row)
|
||||
|
||||
result = pt.get_html_string() if verbose_html else pt.get_string()
|
||||
result += "\n"
|
||||
result += "*Default - default on-line compiler\n"
|
||||
result += "*Supported - supported off-line compiler\n"
|
||||
result += "\n"
|
||||
result += "Total platforms: %d\n"% (target_counter)
|
||||
result += "Total permutations: %d"% (perm_counter)
|
||||
result += "Supported targets: %d\n"% (target_counter)
|
||||
if target_counter == 1:
|
||||
result += "Supported toolchains: %d"% (perm_counter)
|
||||
return result
|
||||
|
||||
|
||||
|
|
|
@ -46,12 +46,12 @@ if __name__ == '__main__':
|
|||
action="store_true",
|
||||
dest="supported_toolchains",
|
||||
default=False,
|
||||
help="Displays supported matrix of MCUs and toolchains")
|
||||
help="Displays supported matrix of targets and toolchains")
|
||||
|
||||
parser.add_option('-f', '--filter',
|
||||
dest='general_filter_regex',
|
||||
default=None,
|
||||
help='For some commands you can use filter to filter out results')
|
||||
help='Filter targets')
|
||||
|
||||
parser.add_option("-v", "--verbose",
|
||||
action="store_true",
|
||||
|
@ -68,12 +68,18 @@ if __name__ == '__main__':
|
|||
|
||||
# If auto_detect attribute is present, we assume other auto-detection
|
||||
# parameters like 'toolchains_filter' are also set.
|
||||
print "[mbed] Detecting connected mbed-enabled devices... "
|
||||
|
||||
MUTs = get_autodetected_MUTS_list()
|
||||
|
||||
count = 0
|
||||
for mut in MUTs.values():
|
||||
print "[mbed] Detected %s, port: %s, mounted: %s"% (mut['mcu'], mut['port'], mut['disk'])
|
||||
print ""
|
||||
print "[mbed] Detected %s, port %s, mounted %s" % (mut['mcu'], mut['port'], mut['disk'])
|
||||
print "[mbed] Supported toolchains for %s" % mut['mcu']
|
||||
print mcu_toolchain_matrix(platform_filter=r'^'+mut['mcu']+'$')
|
||||
count += 1
|
||||
|
||||
if count == 0:
|
||||
print "[mbed] No mbed targets where detected on your system."
|
||||
|
||||
except KeyboardInterrupt, e:
|
||||
print "\n[CTRL+c] exit"
|
||||
|
|
Loading…
Reference in New Issue