diff options
| -rw-r--r-- | progress.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/progress.py b/progress.py index 580ae884..98bb6429 100644 --- a/progress.py +++ b/progress.py | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | # limitations under the License. | 14 | # limitations under the License. |
| 15 | 15 | ||
| 16 | import sys | 16 | import sys |
| 17 | from trace import IsTrace | ||
| 17 | 18 | ||
| 18 | class Progress(object): | 19 | class Progress(object): |
| 19 | def __init__(self, title, total=0): | 20 | def __init__(self, title, total=0): |
| @@ -25,6 +26,9 @@ class Progress(object): | |||
| 25 | def update(self, inc=1): | 26 | def update(self, inc=1): |
| 26 | self._done += inc | 27 | self._done += inc |
| 27 | 28 | ||
| 29 | if IsTrace(): | ||
| 30 | return | ||
| 31 | |||
| 28 | if self._total <= 0: | 32 | if self._total <= 0: |
| 29 | sys.stderr.write('\r%s: %d, ' % ( | 33 | sys.stderr.write('\r%s: %d, ' % ( |
| 30 | self._title, | 34 | self._title, |
| @@ -43,6 +47,9 @@ class Progress(object): | |||
| 43 | sys.stderr.flush() | 47 | sys.stderr.flush() |
| 44 | 48 | ||
| 45 | def end(self): | 49 | def end(self): |
| 50 | if IsTrace(): | ||
| 51 | return | ||
| 52 | |||
| 46 | if self._total <= 0: | 53 | if self._total <= 0: |
| 47 | sys.stderr.write('\r%s: %d, done. \n' % ( | 54 | sys.stderr.write('\r%s: %d, done. \n' % ( |
| 48 | self._title, | 55 | self._title, |
