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.
pull/3227/head
Brian Daniels 2016-10-11 14:31:02 -05:00 committed by Anna Bridge
parent b6366e3e62
commit d1eaefe688
1 changed files with 12 additions and 11 deletions

View File

@ -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':