Skip to content

Added list options for --supported command #3993

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 4 commits into from
Apr 12, 2017
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
69 changes: 69 additions & 0 deletions tools/build_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,75 @@ def get_unique_supported_toolchains(release_targets=None):

return unique_supported_toolchains

def mcu_toolchain_list(release_version='5'):
""" Shows list of toolchains

"""

if isinstance(release_version, basestring):
# Force release_version to lowercase if it is a string
release_version = release_version.lower()
else:
# Otherwise default to printing all known targets and toolchains
release_version = 'all'


version_release_targets = {}
version_release_target_names = {}

for version in RELEASE_VERSIONS:
version_release_targets[version] = get_mbed_official_release(version)
version_release_target_names[version] = [x[0] for x in
version_release_targets[
version]]

if release_version in RELEASE_VERSIONS:
release_targets = version_release_targets[release_version]
else:
release_targets = None

unique_supported_toolchains = get_unique_supported_toolchains(
release_targets)
columns = ["mbed OS %s" % x for x in RELEASE_VERSIONS] + unique_supported_toolchains
return "\n".join(columns)


def mcu_target_list(release_version='5'):
""" Shows target list

"""

if isinstance(release_version, basestring):
# Force release_version to lowercase if it is a string
release_version = release_version.lower()
else:
# Otherwise default to printing all known targets and toolchains
release_version = 'all'


version_release_targets = {}
version_release_target_names = {}

for version in RELEASE_VERSIONS:
version_release_targets[version] = get_mbed_official_release(version)
version_release_target_names[version] = [x[0] for x in
version_release_targets[
version]]

if release_version in RELEASE_VERSIONS:
release_targets = version_release_targets[release_version]
else:
release_targets = None

target_names = []

if release_targets:
target_names = [x[0] for x in release_targets]
else:
target_names = TARGET_NAMES

return "\n".join(target_names)


def mcu_toolchain_matrix(verbose_html=False, platform_filter=None,
release_version='5'):
Expand Down
8 changes: 8 additions & 0 deletions tools/export/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@
To export this project please <a href='http://mbed.org/compiler/?import=http://mbed.org/users/mbed_official/code/mbed-export/k&mode=lib' target='_blank'>import the export version of the mbed library</a>.
"""

def mcu_ide_list():
"""Shows list of exportable ides

"""
supported_ides = sorted(EXPORTERS.keys())
return "\n".join(supported_ides)


def mcu_ide_matrix(verbose_html=False):
"""Shows target map using prettytable

Expand Down
17 changes: 15 additions & 2 deletions tools/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
from tools.options import extract_profile
from tools.build_api import build_project
from tools.build_api import mcu_toolchain_matrix
from tools.build_api import mcu_toolchain_list
from tools.build_api import mcu_target_list
from utils import argparse_filestring_type
from utils import argparse_many
from utils import argparse_dir_not_parent
Expand Down Expand Up @@ -90,9 +92,11 @@
help="Add a macro definition")

group.add_argument("-S", "--supported-toolchains",
action="store_true",
dest="supported_toolchains",
default=False,
const="matrix",
choices=["matrix", "toolchains", "targets"],
nargs="?",
help="Displays supported matrix of MCUs and toolchains")

parser.add_argument('-f', '--filter',
Expand Down Expand Up @@ -182,7 +186,16 @@

# Only prints matrix of supported toolchains
if options.supported_toolchains:
print mcu_toolchain_matrix(platform_filter=options.general_filter_regex)
if options.supported_toolchains == "matrix":
print mcu_toolchain_matrix(platform_filter=options.general_filter_regex)
elif options.supported_toolchains == "toolchains":
toolchain_list = mcu_toolchain_list()
# Only print the lines that matter
for line in toolchain_list.split("\n"):
if not "mbed" in line:
print line
elif options.supported_toolchains == "targets":
print mcu_target_list()
exit(0)

# Print available tests in order and exit
Expand Down
11 changes: 8 additions & 3 deletions tools/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from tools.paths import EXPORT_DIR, MBED_HAL, MBED_LIBRARIES, MBED_TARGETS_PATH
from tools.settings import BUILD_DIR
from tools.export import EXPORTERS, mcu_ide_matrix, export_project, get_exporter_toolchain
from tools.export import EXPORTERS, mcu_ide_matrix, mcu_ide_list, export_project, get_exporter_toolchain
from tools.tests import TESTS, TEST_MAP
from tools.tests import test_known, test_name_known, Test
from tools.targets import TARGET_NAMES
Expand Down Expand Up @@ -145,9 +145,11 @@ def main():
help="list available programs in order and exit")

group.add_argument("-S", "--list-matrix",
action="store_true",
dest="supported_ides",
default=False,
const="matrix",
choices=["matrix", "ides"],
nargs="?",
help="displays supported matrix of MCUs and IDEs")

parser.add_argument("-E",
Expand Down Expand Up @@ -188,7 +190,10 @@ def main():

# Only prints matrix of supported IDEs
if options.supported_ides:
print_large_string(mcu_ide_matrix())
if options.supported_ides == "matrix":
print_large_string(mcu_ide_matrix())
elif options.supported_ides == "ides":
print mcu_ide_list()
exit(0)

# Only prints matrix of supported IDEs
Expand Down