Skip to content

Commit fa6b3fd

Browse files
committed
Adapt sdl2's stuff to the new python2's build system
1 parent 05d976b commit fa6b3fd

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

pythonforandroid/bootstraps/sdl2/__init__.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,11 @@ def run_distribute(self):
3333
with current_directory(self.dist_dir):
3434
info("Copying Python distribution")
3535

36-
hostpython = sh.Command(self.ctx.hostpython)
37-
if self.ctx.python_recipe.name == 'python2':
38-
try:
39-
shprint(hostpython, '-OO', '-m', 'compileall',
40-
python_install_dir,
41-
_tail=10, _filterout="^Listing")
42-
except sh.ErrorReturnCode:
43-
pass
44-
if 'python2' in self.ctx.recipe_build_order and not exists('python-install'):
45-
shprint(
46-
sh.cp, '-a', python_install_dir, './python-install')
47-
4836
self.distribute_libs(arch, [self.ctx.get_libs_dir(arch.arch)])
4937
self.distribute_javaclasses(self.ctx.javaclass_dir,
5038
dest_dir=join("src", "main", "java"))
5139

5240
python_bundle_dir = join('_python_bundle', '_python_bundle')
53-
if 'python2' in self.ctx.recipe_build_order:
54-
# Python 2 is a special case with its own packaging location
55-
python_bundle_dir = 'private'
5641
ensure_dir(python_bundle_dir)
5742

5843
site_packages_dir = self.ctx.python_recipe.create_python_bundle(

pythonforandroid/bootstraps/sdl2/build/build.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
# Try to find a host version of Python that matches our ARM version.
2525
PYTHON = join(curdir, 'python-install', 'bin', 'python.host')
2626
if not exists(PYTHON):
27-
print('Could not find hostpython, will not compile to .pyo (this is normal with python3)')
27+
print('Could not find hostpython, will not compile to .pyo '
28+
'(this is normal with python2 and python3)')
2829
PYTHON = None
2930

3031
BLACKLIST_PATTERNS = [
@@ -126,7 +127,8 @@ def make_python_zip():
126127

127128
if not exists('private'):
128129
print('No compiled python is present to zip, skipping.')
129-
print('this should only be the case if you are using the CrystaX python or python3')
130+
print('this should only be the case if you are using'
131+
'the CrystaX python, python2 or python3')
130132
return
131133

132134
global python_files

pythonforandroid/recipes/sdl2/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ def get_recipe_env(self, arch=None):
2424
env['PYTHON_INCLUDE_ROOT'] = self.ctx.python_recipe.include_root(arch.arch)
2525
env['PYTHON_LINK_ROOT'] = self.ctx.python_recipe.link_root(arch.arch)
2626

27-
if 'python2' in self.ctx.recipe_build_order:
28-
env['EXTRA_LDLIBS'] = ' -lpython2.7'
29-
30-
if 'python3' in self.ctx.recipe_build_order:
31-
env['EXTRA_LDLIBS'] = ' -lpython{}m'.format(
27+
if 'python2' in self.ctx.recipe_build_order or \
28+
'python3' in self.ctx.recipe_build_order:
29+
env['EXTRA_LDLIBS'] = ' -lpython{}'.format(
3230
self.ctx.python_recipe.major_minor_version_string)
31+
if 'python3' in self.ctx.recipe_build_order:
32+
env['EXTRA_LDLIBS'] += 'm'
3333

3434
env['APP_ALLOW_MISSING_DEPS'] = 'true'
3535
return env

0 commit comments

Comments
 (0)