From d1eaefe6884e4e8e17fd0ae8184c4b682418f9bf Mon Sep 17 00:00:00 2001 From: Brian Daniels Date: Tue, 11 Oct 2016 14:31:02 -0500 Subject: [PATCH] Modifying behavior of 'silent' option in toolchains The 'silent' option has always been present in the toolchains API, however it did not actually stop anything from being printed. Instead, it just changed what was added to the build log. This make the 'silent' stop all prints, but ensures that the output for the toolchain is still preserved and accessible via the 'get_output' function. --- tools/toolchains/__init__.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tools/toolchains/__init__.py b/tools/toolchains/__init__.py index 98def03191..c57dda55e6 100644 --- a/tools/toolchains/__init__.py +++ b/tools/toolchains/__init__.py @@ -370,24 +370,24 @@ class mbedToolchain: msg = '[%(severity)s] %(file)s@%(line)s,%(col)s: %(message)s' % event elif event['type'] == 'progress': - if not silent: - if 'percent' in event: - msg = '{} [{:>5.1f}%]: {}'.format(event['action'].title(), - event['percent'], - basename(event['file'])) - else: - msg = '{}: {}'.format(event['action'].title(), - basename(event['file'])) + if 'percent' in event: + msg = '{} [{:>5.1f}%]: {}'.format(event['action'].title(), + event['percent'], + basename(event['file'])) + else: + msg = '{}: {}'.format(event['action'].title(), + basename(event['file'])) if msg: - print msg + if not silent: + print msg self.output += msg + "\n" def print_notify_verbose(self, event, silent=False): """ Default command line notification with more verbose mode """ if event['type'] in ['info', 'debug']: - self.print_notify(event) # standard handle + self.print_notify(event, silent=silent) # standard handle elif event['type'] == 'cc': event['severity'] = event['severity'].title() @@ -396,7 +396,8 @@ class mbedToolchain: event['target_name'] = event['target_name'].upper() if event['target_name'] else "Unknown" event['toolchain_name'] = event['toolchain_name'].upper() if event['toolchain_name'] else "Unknown" msg = '[%(severity)s] %(target_name)s::%(toolchain_name)s::%(file)s@%(line)s: %(message)s' % event - print msg + if not silent: + print msg self.output += msg + "\n" elif event['type'] == 'progress':