|
1 | 1 | import logging |
2 | 2 | import os |
3 | 3 | import re |
4 | | -import sh |
5 | | -from sys import stdout, stderr |
6 | | -from math import log10 |
7 | 4 | from collections import defaultdict |
8 | | -from colorama import Style as Colo_Style, Fore as Colo_Fore |
| 5 | +from math import log10 |
| 6 | +from sys import stdout, stderr |
| 7 | + |
| 8 | +import sh |
9 | 9 | import six |
| 10 | +from colorama import Style as Colo_Style, Fore as Colo_Fore |
10 | 11 |
|
11 | 12 | # This codecs change fixes a bug with log output, but crashes under python3 |
12 | 13 | if not six.PY3: |
@@ -176,19 +177,21 @@ def shprint(command, *args, **kwargs): |
176 | 177 | for line in output: |
177 | 178 | if isinstance(line, bytes): |
178 | 179 | line = line.decode('utf-8', errors='replace') |
179 | | - if logger.level > logging.DEBUG: |
180 | | - msg = line.replace( |
181 | | - '\n', ' ').replace( |
182 | | - '\t', ' ').replace( |
183 | | - '\b', ' ').rstrip() |
184 | | - if msg: |
185 | | - stdout.write(u'{}\r{}{:<{width}}'.format( |
186 | | - Err_Style.RESET_ALL, msg_hdr, |
187 | | - shorten_string(msg, msg_width), width=msg_width)) |
188 | | - stdout.flush() |
189 | | - need_closing_newline = True |
190 | | - else: |
191 | | - logger.debug(''.join(['\t', line.rstrip()])) |
| 180 | + # Workaround for travis ci |
| 181 | + if 'TRAVIS' not in os.environ: |
| 182 | + if logger.level > logging.DEBUG: |
| 183 | + msg = line.replace( |
| 184 | + '\n', ' ').replace( |
| 185 | + '\t', ' ').replace( |
| 186 | + '\b', ' ').rstrip() |
| 187 | + if msg: |
| 188 | + stdout.write(u'{}\r{}{:<{width}}'.format( |
| 189 | + Err_Style.RESET_ALL, msg_hdr, |
| 190 | + shorten_string(msg, msg_width), width=msg_width)) |
| 191 | + stdout.flush() |
| 192 | + need_closing_newline = True |
| 193 | + else: |
| 194 | + logger.debug(''.join(['\t', line.rstrip()])) |
192 | 195 | if need_closing_newline: |
193 | 196 | stdout.write('{}\r{:>{width}}\r'.format( |
194 | 197 | Err_Style.RESET_ALL, ' ', width=(columns - 1))) |
|
0 commit comments