Skip to content

Commit d1a0014

Browse files
committed
restore pyo compilation and prevent py to be copied (works for python2, will fail with python3)
1 parent 1829431 commit d1a0014

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

pythonforandroid/bootstraps/sdl2/build/build.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,16 @@
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 '
28-
'(this is normal with python2 and python3)')
2927
PYTHON = None
28+
# try to check dist_info.json
29+
with open(join(curdir, 'dist_info.json'), 'r') as fd:
30+
dist_info = json.load(fd)
31+
PYTHON = dist_info.get('hostpython')
32+
if PYTHON:
33+
print('Found hostpython in dist_info.json (at {})'.format(PYTHON))
34+
else:
35+
print('Could not find hostpython, will not compile to .pyo '
36+
'(this is normal with python2 and python3)')
3037

3138
BLACKLIST_PATTERNS = [
3239
# code versionning
@@ -36,6 +43,7 @@
3643
'^*.svn/*',
3744

3845
# pyc/py
46+
'*.py',
3947
'*.pyc',
4048

4149
# temp files

pythonforandroid/distribution.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ def save_info(self, dirn):
205205
'bootstrap': self.ctx.bootstrap.name,
206206
'archs': [arch.arch for arch in self.ctx.archs],
207207
'ndk_api': self.ctx.ndk_api,
208-
'recipes': self.ctx.recipe_build_order + self.ctx.python_modules},
208+
'recipes': self.ctx.recipe_build_order + self.ctx.python_modules,
209+
'hostpython': self.ctx.hostpython},
209210
fileh)
210211

211212

0 commit comments

Comments
 (0)