Skip to content

Commit d6c6db3

Browse files
committed
Disable logs for travis
1 parent e9a558f commit d6c6db3

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

pythonforandroid/logger.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import logging
22
import os
33
import re
4-
import sh
5-
from sys import stdout, stderr
6-
from math import log10
74
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
99
import six
10+
from colorama import Style as Colo_Style, Fore as Colo_Fore
1011

1112
# This codecs change fixes a bug with log output, but crashes under python3
1213
if not six.PY3:
@@ -176,19 +177,21 @@ def shprint(command, *args, **kwargs):
176177
for line in output:
177178
if isinstance(line, bytes):
178179
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()]))
192195
if need_closing_newline:
193196
stdout.write('{}\r{:>{width}}\r'.format(
194197
Err_Style.RESET_ALL, ' ', width=(columns - 1)))

pythonforandroid/toolchain.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,8 @@ def add_parser(subparsers, *args, **kwargs):
516516

517517
setup_color(args.color)
518518

519-
# if args.debug:
520-
logger.setLevel(logging.WARNING)
519+
if args.debug:
520+
logger.setLevel(logging.DEBUG)
521521

522522
# strip version from requirements, and put them in environ
523523
if hasattr(args, 'requirements'):

0 commit comments

Comments
 (0)