projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
patman: Drop references to __future__
[oweals/u-boot.git]
/
tools
/
patman
/
tout.py
diff --git
a/tools/patman/tout.py
b/tools/patman/tout.py
index c5fbd80dbcef2e342c518de8297b5c02386c2acf..ee3c519c80baf041adc3178408edf08f661648c3 100644
(file)
--- a/
tools/patman/tout.py
+++ b/
tools/patman/tout.py
@@
-1,7
+1,6
@@
+# SPDX-License-Identifier: GPL-2.0+
# Copyright (c) 2016 Google, Inc
#
# Copyright (c) 2016 Google, Inc
#
-# SPDX-License-Identifier: GPL-2.0+
-#
# Terminal output logging.
#
# Terminal output logging.
#
@@
-10,11
+9,9
@@
import sys
import terminal
# Output verbosity levels that we support
import terminal
# Output verbosity levels that we support
-ERROR = 0
-WARNING = 1
-NOTICE = 2
-INFO = 3
-DEBUG = 4
+ERROR, WARNING, NOTICE, INFO, DETAIL, DEBUG = range(6)
+
+in_progress = False
"""
This class handles output of progress and other useful information
"""
This class handles output of progress and other useful information
@@
-49,9
+46,11
@@
def UserIsPresent():
def ClearProgress():
"""Clear any active progress message on the terminal."""
def ClearProgress():
"""Clear any active progress message on the terminal."""
- if verbose > 0 and stdout_is_tty:
+ global in_progress
+ if verbose > 0 and stdout_is_tty and in_progress:
_stdout.write('\r%s\r' % (" " * len (_progress)))
_stdout.flush()
_stdout.write('\r%s\r' % (" " * len (_progress)))
_stdout.flush()
+ in_progress = False
def Progress(msg, warning=False, trailer='...'):
"""Display progress information.
def Progress(msg, warning=False, trailer='...'):
"""Display progress information.
@@
-59,6
+58,7
@@
def Progress(msg, warning=False, trailer='...'):
Args:
msg: Message to display.
warning: True if this is a warning."""
Args:
msg: Message to display.
warning: True if this is a warning."""
+ global in_progress
ClearProgress()
if verbose > 0:
_progress = msg + trailer
ClearProgress()
if verbose > 0:
_progress = msg + trailer
@@
-66,6
+66,7
@@
def Progress(msg, warning=False, trailer='...'):
col = _color.YELLOW if warning else _color.GREEN
_stdout.write('\r' + _color.Color(col, _progress))
_stdout.flush()
col = _color.YELLOW if warning else _color.GREEN
_stdout.write('\r' + _color.Color(col, _progress))
_stdout.flush()
+ in_progress = True
else:
_stdout.write(_progress + '\n')
else:
_stdout.write(_progress + '\n')
@@
-82,7
+83,7
@@
def _Output(level, msg, color=None):
ClearProgress()
if color:
msg = _color.Color(color, msg)
ClearProgress()
if color:
msg = _color.Color(color, msg)
-
_stdout.write(msg + '\n'
)
+
print(msg
)
def DoOutput(level, msg):
"""Output a message to the terminal.
def DoOutput(level, msg):
"""Output a message to the terminal.
@@
-100,7
+101,7
@@
def Error(msg):
Args:
msg; Message to display.
"""
Args:
msg; Message to display.
"""
- _Output(
0
, msg, _color.RED)
+ _Output(
ERROR
, msg, _color.RED)
def Warning(msg):
"""Display a warning message
def Warning(msg):
"""Display a warning message
@@
-108,7
+109,7
@@
def Warning(msg):
Args:
msg; Message to display.
"""
Args:
msg; Message to display.
"""
- _Output(
1
, msg, _color.YELLOW)
+ _Output(
WARNING
, msg, _color.YELLOW)
def Notice(msg):
"""Display an important infomation message
def Notice(msg):
"""Display an important infomation message
@@
-116,7
+117,7
@@
def Notice(msg):
Args:
msg; Message to display.
"""
Args:
msg; Message to display.
"""
- _Output(
2
, msg)
+ _Output(
NOTICE
, msg)
def Info(msg):
"""Display an infomation message
def Info(msg):
"""Display an infomation message
@@
-124,7
+125,15
@@
def Info(msg):
Args:
msg; Message to display.
"""
Args:
msg; Message to display.
"""
- _Output(3, msg)
+ _Output(INFO, msg)
+
+def Detail(msg):
+ """Display a detailed message
+
+ Args:
+ msg; Message to display.
+ """
+ _Output(DETAIL, msg)
def Debug(msg):
"""Display a debug message
def Debug(msg):
"""Display a debug message
@@
-132,7
+141,7
@@
def Debug(msg):
Args:
msg; Message to display.
"""
Args:
msg; Message to display.
"""
- _Output(
4
, msg)
+ _Output(
DEBUG
, msg)
def UserOutput(msg):
"""Display a message regardless of the current output level.
def UserOutput(msg):
"""Display a message regardless of the current output level.