Skip to content

Commit 599ed2e

Browse files
authored
Merge pull request kivy#948 from inclement/strip_python3_object_files
Made the sdl2 bootstrap strip unneeded symbols with python3
2 parents 8d7b91b + 61f5225 commit 599ed2e

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

pythonforandroid/recipe.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -737,9 +737,7 @@ class PythonRecipe(Recipe):
737737

738738
def clean_build(self, arch=None):
739739
super(PythonRecipe, self).clean_build(arch=arch)
740-
name = self.site_packages_name
741-
if name is None:
742-
name = self.name
740+
name = self.folder_name
743741
python_install_dirs = glob.glob(join(self.ctx.python_installs_dir, '*'))
744742
for python_install in python_install_dirs:
745743
site_packages_dir = glob.glob(join(python_install, 'lib', 'python*',
@@ -766,6 +764,14 @@ def hostpython_location(self):
766764
return self.real_hostpython_location
767765
return self.ctx.hostpython
768766

767+
@property
768+
def folder_name(self):
769+
'''The name of the build folders containing this recipe.'''
770+
name = self.site_packages_name
771+
if name is None:
772+
name = self.name
773+
return name
774+
769775
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
770776
env = super(PythonRecipe, self).get_recipe_env(arch, with_flags_in_cc)
771777
if not self.call_hostpython_via_targetpython:
@@ -782,10 +788,7 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True):
782788
return env
783789

784790
def should_build(self, arch):
785-
print('name is', self.site_packages_name, type(self))
786-
name = self.site_packages_name
787-
if name is None:
788-
name = self.name
791+
name = self.folder_name
789792
if self.ctx.has_package(name):
790793
info('Python package already exists in site-packages')
791794
return False
@@ -1010,11 +1013,20 @@ def build_cython_components(self, arch):
10101013
info('First build appeared to complete correctly, skipping manual'
10111014
'cythonising.')
10121015

1013-
print('stripping')
1014-
build_lib = glob.glob('./build/lib*')
1015-
shprint(sh.find, build_lib[0], '-name', '*.o', '-exec',
1016-
env['STRIP'], '{}', ';', _env=env)
1017-
print('stripped!?')
1016+
if 'python2' in self.ctx.recipe_build_order:
1017+
info('Stripping object files')
1018+
build_lib = glob.glob('./build/lib*')
1019+
shprint(sh.find, build_lib[0], '-name', '*.o', '-exec',
1020+
env['STRIP'], '{}', ';', _env=env)
1021+
1022+
if 'python3crystax' in self.ctx.recipe_build_order:
1023+
info('Stripping object files')
1024+
shprint(sh.find, '.', '-iname', '*.so', '-exec',
1025+
'/usr/bin/echo', '{}', ';', _env=env)
1026+
shprint(sh.find, '.', '-iname', '*.so', '-exec',
1027+
env['STRIP'].split(' ')[0], '--strip-unneeded',
1028+
# '/usr/bin/strip', '--strip-unneeded',
1029+
'{}', ';', _env=env)
10181030

10191031
def cythonize_file(self, env, build_dir, filename):
10201032
short_filename = filename

0 commit comments

Comments
 (0)