Skip to content

Commit 8ebea2e

Browse files
authored
Merge pull request #1727 from mkg20001/feat-ci-mode
Add CI environment variable to disable download progress
2 parents 593aa1e + 1ea1982 commit 8ebea2e

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ before_script:
3232

3333
script:
3434
- docker build --tag=p4a --file Dockerfile.py3 .
35-
- docker run p4a /bin/sh -c "$COMMAND"
35+
- docker run -e CI p4a /bin/sh -c "$COMMAND"

pythonforandroid/logger.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,12 @@ def shprint(command, *args, **kwargs):
188188
'\t', ' ').replace(
189189
'\b', ' ').rstrip()
190190
if msg:
191-
stdout.write(u'{}\r{}{:<{width}}'.format(
192-
Err_Style.RESET_ALL, msg_hdr,
193-
shorten_string(msg, msg_width), width=msg_width))
194-
stdout.flush()
195-
need_closing_newline = True
191+
if "CI" not in os.environ:
192+
stdout.write(u'{}\r{}{:<{width}}'.format(
193+
Err_Style.RESET_ALL, msg_hdr,
194+
shorten_string(msg, msg_width), width=msg_width))
195+
stdout.flush()
196+
need_closing_newline = True
196197
else:
197198
logger.debug(''.join(['\t', line.rstrip()]))
198199
if need_closing_newline:

pythonforandroid/recipe.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,9 @@ def report_hook(index, blksize, size):
140140
else:
141141
progression = '{0:.2f}%'.format(
142142
index * blksize * 100. / float(size))
143-
stdout.write('- Download {}\r'.format(progression))
144-
stdout.flush()
143+
if "CI" not in environ:
144+
stdout.write('- Download {}\r'.format(progression))
145+
stdout.flush()
145146

146147
if exists(target):
147148
unlink(target)

0 commit comments

Comments
 (0)