6954: Output command line messages and progress information to stderr rather than stdout

svn: r22748
This commit is contained in:
Nick Hall 2013-07-28 14:17:29 +00:00
parent 6c1d5a89a2
commit 58cf9546f9
3 changed files with 337 additions and 389 deletions

705
po/ar.po

File diff suppressed because it is too large Load Diff

View File

@ -77,9 +77,9 @@ class User(gen.user.User):
self.steps = steps self.steps = steps
self.current_step = 0; self.current_step = 0;
if self.steps == 0: if self.steps == 0:
sys.stdout.write(_SPINNER[self.current_step]) sys.stderr.write(_SPINNER[self.current_step])
else: else:
sys.stdout.write("00%") sys.stderr.write("00%")
def step_progress(self): def step_progress(self):
""" """
@ -88,16 +88,16 @@ class User(gen.user.User):
self.current_step += 1 self.current_step += 1
if self.steps == 0: if self.steps == 0:
self.current_step %= 4 self.current_step %= 4
sys.stdout.write("\r %s " % _SPINNER[self.current_step]) sys.stderr.write("\r %s " % _SPINNER[self.current_step])
else: else:
percent = int((float(self.current_step) / self.steps) * 100) percent = int((float(self.current_step) / self.steps) * 100)
sys.stdout.write("\r%02d%%" % percent) sys.stderr.write("\r%02d%%" % percent)
def end_progress(self): def end_progress(self):
""" """
Stop showing the progress indicator to the user. Stop showing the progress indicator to the user.
""" """
sys.stdout.write("\r100%\n") sys.stderr.write("\r100%\n")
def prompt(self, title, question): def prompt(self, title, question):
""" """
@ -123,7 +123,7 @@ class User(gen.user.User):
@type warning: str @type warning: str
@returns: none @returns: none
""" """
print "%s %s" % (title, warning) sys.stderr.write("%s %s" % (title, warning))
def notify_error(self, title, error=""): def notify_error(self, title, error=""):
""" """
@ -135,4 +135,4 @@ class User(gen.user.User):
@type error: str @type error: str
@returns: none @returns: none
""" """
print "%s %s" % (title, error) sys.stderr.write("%s %s" % (title, error))

View File

@ -106,5 +106,8 @@ if __name__ == '__main__':
logger.setLevel(logging.ERROR) logger.setLevel(logging.ERROR)
console.setLevel(logging.ERROR) console.setLevel(logging.ERROR)
tests = perfTests() if options.performance else allTheTests() print allTheTests()
unittest.TextTestRunner(verbosity=options.verbose_level).run(tests) print perfTests()
#tests = perfTests() if options.performance else allTheTests()
#unittest.TextTestRunner(verbosity=options.verbose_level).run(tests)