Skip to content

Commit 5bdaf52

Browse files
committed
toolchain log output cosmetic
1 parent 406b236 commit 5bdaf52

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

pythonforandroid/bootstraps/pygame/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def run_distribute(self):
4343
info('Copying python distribution')
4444
hostpython = sh.Command(self.ctx.hostpython)
4545
# AND: This *doesn't* need to be in arm env?
46-
shprint(hostpython, '-OO', '-m', 'compileall', self.ctx.get_python_install_dir())
46+
shprint(hostpython, '-OO', '-m', 'compileall', self.ctx.get_python_install_dir(),
47+
_tail=10, _critical=True)
4748
if not exists('python-install'):
4849
shprint(sh.cp, '-a', self.ctx.get_python_install_dir(), './python-install')
4950

pythonforandroid/recipes/pygame/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ def build_armeabi(self):
6060
with current_directory(self.get_build_dir('armeabi')):
6161
info('hostpython is ' + self.ctx.hostpython)
6262
hostpython = sh.Command(self.ctx.hostpython)
63-
shprint(hostpython, 'setup.py', 'install', '-O2', _env=env)
63+
shprint(hostpython, 'setup.py', 'install', '-O2', _env=env,
64+
_tail=10, _critical=True)
6465

6566
info('strip is ' + env['STRIP'])
6667
build_lib = glob.glob('./build/lib*')

pythonforandroid/recipes/sdl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def build_armeabi(self):
1818
env = ArchAndroid(self.ctx).get_env()
1919

2020
with current_directory(self.get_jni_dir()):
21-
shprint(sh.ndk_build, 'V=1', _env=env)
21+
shprint(sh.ndk_build, 'V=1', _env=env, _tail=20, _critical=True)
2222

2323
libs_dir = join(self.ctx.bootstrap.build_dir, 'libs', 'armeabi')
2424
import os

pythonforandroid/toolchain.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,14 @@ def shprint(command, *args, **kwargs):
159159
except sh.ErrorReturnCode, err:
160160
if need_closing_newline: sys.stdout.write('{}\r{:>{width}}\r'.format(Style.RESET_ALL, ' ', width=(columns - 1)))
161161
if tail_n:
162-
lines = err.stdout.splitlines()
163-
if len(lines) <= tail_n:
164-
info('STDOUT:\n{}\t{}{}'.format(Fore.YELLOW, '\t\n'.join(lines), Fore.RESET))
165-
else:
166-
info('STDOUT (last {} lines of {}):\n{}\t{}{}'.format(tail_n, len(lines), Fore.YELLOW, '\t\n'.join(lines[-tail_n:]), Fore.RESET))
167-
lines = err.stderr.splitlines()
168-
if len(lines):
169-
warning('STDERR:\n{}\t{}{}'.format(Fore.RED, '\t\n'.join(lines), Fore.RESET))
162+
def printtail(name, forecolor, tail_n, out):
163+
lines = out.splitlines()
164+
if tail_n == 0 or len(lines) <= tail_n:
165+
info('{}:\n{}\t{}{}'.format(name, forecolor, '\t\n'.join(lines), Fore.RESET))
166+
else:
167+
info('{} (last {} lines of {}):\n{}\t{}{}'.format(name, tail_n, len(lines), forecolor, '\t\n'.join(lines[-tail_n:]), Fore.RESET))
168+
printtail('STDOUT', Fore.YELLOW, tail_n, err.stdout)
169+
printtail('STDERR', Fore.RED, 0, err.stderr)
170170
if is_critical:
171171
warning("{}ERROR: {} failed!{}".format(Fore.RED, command, Fore.RESET))
172172
exit(1)

0 commit comments

Comments
 (0)