| OLD | NEW |
| 1 # | 1 # |
| 2 # Copyright (C) 2009 The Android Open Source Project | 2 # Copyright (C) 2009 The Android Open Source Project |
| 3 # | 3 # |
| 4 # Licensed under the Apache License, Version 2.0 (the "License"); | 4 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 # you may not use this file except in compliance with the License. | 5 # you may not use this file except in compliance with the License. |
| 6 # You may obtain a copy of the License at | 6 # You may obtain a copy of the License at |
| 7 # | 7 # |
| 8 # http://www.apache.org/licenses/LICENSE-2.0 | 8 # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 # | 9 # |
| 10 # Unless required by applicable law or agreed to in writing, software | 10 # Unless required by applicable law or agreed to in writing, software |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 spaces = max(self._width - len(text), 0) | 52 spaces = max(self._width - len(text), 0) |
| 53 sys.stdout.write('%s%*s\r' % (text, spaces, '')) | 53 sys.stdout.write('%s%*s\r' % (text, spaces, '')) |
| 54 sys.stdout.flush() | 54 sys.stdout.flush() |
| 55 self._width = len(text) | 55 self._width = len(text) |
| 56 | 56 |
| 57 def end(self): | 57 def end(self): |
| 58 if not self._show: | 58 if not self._show: |
| 59 return | 59 return |
| 60 | 60 |
| 61 if self._total <= 0: | 61 if self._total <= 0: |
| 62 sys.stdout.write('%s: %d, done.\n' % ( | 62 text = '%s: %d, done.' % ( |
| 63 self._title, | 63 self._title, |
| 64 self._done)) | 64 self._done) |
| 65 sys.stdout.flush() | |
| 66 else: | 65 else: |
| 67 p = (100 * self._done) / self._total | 66 p = (100 * self._done) / self._total |
| 68 sys.stdout.write('%s: %3d%% (%d/%d), done.\n' % ( | 67 text = '%s: %3d%% (%d/%d), done.' % ( |
| 69 self._title, | 68 self._title, |
| 70 p, | 69 p, |
| 71 self._done, | 70 self._done, |
| 72 self._total)) | 71 self._total) |
| 73 sys.stdout.flush() | 72 |
| 73 spaces = max(self._width - len(text), 0) |
| 74 sys.stdout.write('%s%*s\n' % (text, spaces, '')) |
| 75 sys.stdout.flush() |
| OLD | NEW |