mirror of https://github.com/ARMmbed/mbed-os.git
Call colorized notify when --color for build.py, make.py, test.py
parent
6b8bde9471
commit
12492c17b8
|
@ -28,6 +28,7 @@ sys.path.insert(0, ROOT)
|
||||||
|
|
||||||
|
|
||||||
from tools.toolchains import TOOLCHAINS
|
from tools.toolchains import TOOLCHAINS
|
||||||
|
from tools.toolchains import mbedToolchain
|
||||||
from tools.targets import TARGET_NAMES, TARGET_MAP
|
from tools.targets import TARGET_NAMES, TARGET_MAP
|
||||||
from tools.options import get_default_options_parser
|
from tools.options import get_default_options_parser
|
||||||
from tools.build_api import build_library, build_mbed_libs, build_lib
|
from tools.build_api import build_library, build_mbed_libs, build_lib
|
||||||
|
@ -36,6 +37,7 @@ from tools.build_api import static_analysis_scan, static_analysis_scan_lib, stat
|
||||||
from tools.build_api import print_build_results
|
from tools.build_api import print_build_results
|
||||||
from tools.settings import CPPCHECK_CMD, CPPCHECK_MSG_FORMAT
|
from tools.settings import CPPCHECK_CMD, CPPCHECK_MSG_FORMAT
|
||||||
from utils import argparse_filestring_type
|
from utils import argparse_filestring_type
|
||||||
|
from tools.settings import CPPCHECK_CMD, CPPCHECK_MSG_FORMAT, CLI_COLOR_MAP
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
start = time()
|
start = time()
|
||||||
|
@ -164,6 +166,17 @@ if __name__ == '__main__':
|
||||||
# Get toolchains list
|
# Get toolchains list
|
||||||
toolchains = options.tool if options.tool else TOOLCHAINS
|
toolchains = options.tool if options.tool else TOOLCHAINS
|
||||||
|
|
||||||
|
if options.color:
|
||||||
|
# This import happens late to prevent initializing colorization when we don't need it
|
||||||
|
import colorize
|
||||||
|
if options.verbose:
|
||||||
|
notify = mbedToolchain.print_notify_verbose
|
||||||
|
else:
|
||||||
|
notify = mbedToolchain.print_notify
|
||||||
|
notify = colorize.print_in_color_notifier(CLI_COLOR_MAP, notify)
|
||||||
|
else:
|
||||||
|
notify = None
|
||||||
|
|
||||||
# Get libraries list
|
# Get libraries list
|
||||||
libraries = []
|
libraries = []
|
||||||
|
|
||||||
|
@ -224,6 +237,7 @@ if __name__ == '__main__':
|
||||||
lib_build_res = build_library(options.source_dir, options.build_dir, mcu, toolchain,
|
lib_build_res = build_library(options.source_dir, options.build_dir, mcu, toolchain,
|
||||||
options=options.options,
|
options=options.options,
|
||||||
extra_verbose=options.extra_verbose_notify,
|
extra_verbose=options.extra_verbose_notify,
|
||||||
|
notify=notify,
|
||||||
verbose=options.verbose,
|
verbose=options.verbose,
|
||||||
silent=options.silent,
|
silent=options.silent,
|
||||||
jobs=options.jobs,
|
jobs=options.jobs,
|
||||||
|
@ -235,6 +249,7 @@ if __name__ == '__main__':
|
||||||
lib_build_res = build_mbed_libs(mcu, toolchain,
|
lib_build_res = build_mbed_libs(mcu, toolchain,
|
||||||
options=options.options,
|
options=options.options,
|
||||||
extra_verbose=options.extra_verbose_notify,
|
extra_verbose=options.extra_verbose_notify,
|
||||||
|
notify=notify,
|
||||||
verbose=options.verbose,
|
verbose=options.verbose,
|
||||||
silent=options.silent,
|
silent=options.silent,
|
||||||
jobs=options.jobs,
|
jobs=options.jobs,
|
||||||
|
@ -245,6 +260,7 @@ if __name__ == '__main__':
|
||||||
build_lib(lib_id, mcu, toolchain,
|
build_lib(lib_id, mcu, toolchain,
|
||||||
options=options.options,
|
options=options.options,
|
||||||
extra_verbose=options.extra_verbose_notify,
|
extra_verbose=options.extra_verbose_notify,
|
||||||
|
notify=notify,
|
||||||
verbose=options.verbose,
|
verbose=options.verbose,
|
||||||
silent=options.silent,
|
silent=options.silent,
|
||||||
clean=options.clean,
|
clean=options.clean,
|
||||||
|
|
|
@ -46,6 +46,8 @@ from tools.build_api import mcu_toolchain_matrix
|
||||||
from utils import argparse_filestring_type
|
from utils import argparse_filestring_type
|
||||||
from utils import argparse_many
|
from utils import argparse_many
|
||||||
from argparse import ArgumentTypeError
|
from argparse import ArgumentTypeError
|
||||||
|
from tools.toolchains import mbedToolchain
|
||||||
|
from tools.settings import CLI_COLOR_MAP
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Parse Options
|
# Parse Options
|
||||||
|
@ -212,6 +214,17 @@ if __name__ == '__main__':
|
||||||
args_error(parser, "[ERROR] You should specify a TOOLCHAIN")
|
args_error(parser, "[ERROR] You should specify a TOOLCHAIN")
|
||||||
toolchain = options.tool[0]
|
toolchain = options.tool[0]
|
||||||
|
|
||||||
|
if options.color:
|
||||||
|
# This import happens late to prevent initializing colorization when we don't need it
|
||||||
|
import colorize
|
||||||
|
if options.verbose:
|
||||||
|
notify = mbedToolchain.print_notify_verbose
|
||||||
|
else:
|
||||||
|
notify = mbedToolchain.print_notify
|
||||||
|
notify = colorize.print_in_color_notifier(CLI_COLOR_MAP, notify)
|
||||||
|
else:
|
||||||
|
notify = None
|
||||||
|
|
||||||
# Test
|
# Test
|
||||||
for test_no in p:
|
for test_no in p:
|
||||||
test = Test(test_no)
|
test = Test(test_no)
|
||||||
|
@ -250,6 +263,7 @@ if __name__ == '__main__':
|
||||||
linker_script=options.linker_script,
|
linker_script=options.linker_script,
|
||||||
clean=options.clean,
|
clean=options.clean,
|
||||||
verbose=options.verbose,
|
verbose=options.verbose,
|
||||||
|
notify=notify,
|
||||||
silent=options.silent,
|
silent=options.silent,
|
||||||
macros=options.macros,
|
macros=options.macros,
|
||||||
jobs=options.jobs,
|
jobs=options.jobs,
|
||||||
|
|
|
@ -34,6 +34,8 @@ from tools.targets import TARGET_MAP
|
||||||
from tools.utils import mkdir, ToolException, NotSupportedException
|
from tools.utils import mkdir, ToolException, NotSupportedException
|
||||||
from tools.test_exporters import ReportExporter, ResultExporterType
|
from tools.test_exporters import ReportExporter, ResultExporterType
|
||||||
from utils import argparse_filestring_type, argparse_lowercase_type, argparse_many
|
from utils import argparse_filestring_type, argparse_lowercase_type, argparse_many
|
||||||
|
from tools.toolchains import mbedToolchain
|
||||||
|
from tools.settings import CLI_COLOR_MAP
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
|
@ -121,6 +123,17 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
tests = all_tests
|
tests = all_tests
|
||||||
|
|
||||||
|
if options.color:
|
||||||
|
# This import happens late to prevent initializing colorization when we don't need it
|
||||||
|
import colorize
|
||||||
|
if options.verbose:
|
||||||
|
notify = mbedToolchain.print_notify_verbose
|
||||||
|
else:
|
||||||
|
notify = mbedToolchain.print_notify
|
||||||
|
notify = colorize.print_in_color_notifier(CLI_COLOR_MAP, notify)
|
||||||
|
else:
|
||||||
|
notify = None
|
||||||
|
|
||||||
if options.list:
|
if options.list:
|
||||||
# Print available tests in order and exit
|
# Print available tests in order and exit
|
||||||
print_tests(tests, options.format)
|
print_tests(tests, options.format)
|
||||||
|
@ -155,6 +168,7 @@ if __name__ == '__main__':
|
||||||
name="mbed-build",
|
name="mbed-build",
|
||||||
macros=options.macros,
|
macros=options.macros,
|
||||||
verbose=options.verbose,
|
verbose=options.verbose,
|
||||||
|
notify=notify,
|
||||||
archive=False)
|
archive=False)
|
||||||
|
|
||||||
library_build_success = True
|
library_build_success = True
|
||||||
|
@ -179,6 +193,7 @@ if __name__ == '__main__':
|
||||||
properties=build_properties,
|
properties=build_properties,
|
||||||
macros=options.macros,
|
macros=options.macros,
|
||||||
verbose=options.verbose,
|
verbose=options.verbose,
|
||||||
|
notify=notify,
|
||||||
jobs=options.jobs,
|
jobs=options.jobs,
|
||||||
continue_on_build_fail=options.continue_on_build_fail)
|
continue_on_build_fail=options.continue_on_build_fail)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue