Skip to content

Commit 6ff7317

Browse files
committed
bootstrap/sdl2: don't strip non-existant file or 0-bytes files
1 parent 310048d commit 6ff7317

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pythonforandroid/bootstraps/sdl2/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from pythonforandroid.toolchain import Bootstrap, shprint, current_directory, info, warning, ArchAndroid, logger, info_main, which
2-
from os.path import join, exists
2+
from os.path import join, exists, getsize
33
from os import walk
44
import glob
55
import sh
@@ -27,7 +27,7 @@ def run_distribute(self):
2727
shprint(sh.mkdir, 'private')
2828
if not exists('assets'):
2929
shprint(sh.mkdir, 'assets')
30-
30+
3131
hostpython = sh.Command(self.ctx.hostpython)
3232
# AND: This *doesn't* need to be in arm env?
3333
shprint(hostpython, '-OO', '-m', 'compileall',
@@ -50,7 +50,7 @@ def run_distribute(self):
5050
info('private/lib does not exist, making')
5151
shprint(sh.cp, '-a', join('python-install', 'lib'), 'private')
5252
shprint(sh.mkdir, '-p', join('private', 'include', 'python2.7'))
53-
53+
5454
# AND: Copylibs stuff should go here
5555
if exists(join('libs', 'armeabi', 'libpymodules.so')):
5656
shprint(sh.mv, join('libs', 'armeabi', 'libpymodules.so'), 'private/')
@@ -93,9 +93,10 @@ def run_distribute(self):
9393
logger.info('Stripping libraries in private dir')
9494
for filen in filens.split('\n'):
9595
try:
96-
strip(filen, _env=env)
96+
if exists(filen) and getsize(filen):
97+
strip(filen, _env=env)
9798
except sh.ErrorReturnCode_1:
98-
logger.debug('Failed to strip ' + 'filen')
99+
logger.debug('Failed to strip ' + filen)
99100
super(SDL2Bootstrap, self).run_distribute()
100101

101102
bootstrap = SDL2Bootstrap()

0 commit comments

Comments
 (0)