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,7 +370,6 @@ class mbedToolchain:
msg = '[%(severity)s] %(file)s@%(line)s,%(col)s: %(message)s' % event msg = '[%(severity)s] %(file)s@%(line)s,%(col)s: %(message)s' % event
elif event['type'] == 'progress': elif event['type'] == 'progress':
if not silent:
if 'percent' in event: if 'percent' in event:
msg = '{} [{:>5.1f}%]: {}'.format(event['action'].title(), msg = '{} [{:>5.1f}%]: {}'.format(event['action'].title(),
event['percent'], event['percent'],
@ -380,6 +379,7 @@ class mbedToolchain:
basename(event['file'])) basename(event['file']))
if msg: if msg:
if not silent:
print msg print msg
self.output += msg + "\n" self.output += msg + "\n"
@ -387,7 +387,7 @@ class mbedToolchain:
""" Default command line notification with more verbose mode """ Default command line notification with more verbose mode
""" """
if event['type'] in ['info', 'debug']: if event['type'] in ['info', 'debug']:
self.print_notify(event) # standard handle self.print_notify(event, silent=silent) # standard handle
elif event['type'] == 'cc': elif event['type'] == 'cc':
event['severity'] = event['severity'].title() event['severity'] = event['severity'].title()
@ -396,6 +396,7 @@ class mbedToolchain:
event['target_name'] = event['target_name'].upper() if event['target_name'] else "Unknown" 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" 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 msg = '[%(severity)s] %(target_name)s::%(toolchain_name)s::%(file)s@%(line)s: %(message)s' % event
if not silent:
print msg print msg
self.output += msg + "\n" self.output += msg + "\n"