Bug 915508 - Change the order of space and comma in the mach status line when several directories are built at the same time; r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 12 Sep 2013 15:14:11 +0900
changeset 146817 79d504af18f6ca2aed025ec1915f8efa4a1b8fa3
parent 146816 4473d84c6ab6e2190d92aab9fbe09c08117bd612
child 146818 b86d7ce8d1ebd1e44e6a8c28134b90d294dcfd4d
push id33707
push usergszorc@mozilla.com
push dateThu, 12 Sep 2013 16:12:58 +0000
treeherdermozilla-inbound@b86d7ce8d1eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs915508
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 915508 - Change the order of space and comma in the mach status line when several directories are built at the same time; r=gps
python/mozbuild/mozbuild/mach_commands.py
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -1,14 +1,15 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, # You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import print_function, unicode_literals
 
+import itertools
 import logging
 import operator
 import os
 import sys
 
 from mach.decorators import (
     CommandArgument,
     CommandProvider,
@@ -155,21 +156,22 @@ class BuildProgressFooter(object):
 
                 parts.extend([
                     '%02d' % (complete + 1),
                     '/',
                     '%02d' % len(all_dirs),
                     ' ',
                     '(',
                 ])
-                for d in active_dirs:
-                    parts.extend([
-                        ('magenta', d), ' ,'
-                    ])
-                parts[-1] = ')'
+                if active_dirs:
+                    commas = [', '] * (len(active_dirs) - 1)
+                    magenta_dirs = [('magenta', d) for d in active_dirs]
+                    parts.extend(i.next() for i in itertools.cycle((iter(magenta_dirs),
+                                                                    iter(commas))))
+                parts.append(')')
 
             if not have_dirs:
                 parts = parts[0:-2]
 
         # We don't want to write more characters than the current width of the
         # terminal otherwise wrapping may result in weird behavior. We can't
         # simply truncate the line at terminal width characters because a)
         # non-viewable escape characters count towards the limit and b) we