Skip to content

Commit 876ca43

Browse files
committed
Fix python3's compileall command for build.py file
Because as of Python 3.5, the .pyo filename extension is no longer used, see: - `PEP 488 -- Elimination of PYO files` (https://www.python.org/dev/peps/pep-0488/) - `PEP 3147 -- PYC Repository Directories` as to why a separate directory is used (https://www.python.org/dev/peps/pep-3147/) Also moves comment to the right place
1 parent c225bf2 commit 876ca43

File tree

1 file changed

+6
-2
lines changed
  • pythonforandroid/bootstraps/common/build

1 file changed

+6
-2
lines changed

pythonforandroid/bootstraps/common/build/build.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,15 @@ def compile_dir(dfn, optimize_python=True):
252252
if get_bootstrap_name() != "sdl2":
253253
# HISTORICALLY DISABLED for other than sdl2. NEEDS REVIEW! -JonasT
254254
return
255-
# -OO = strip docstrings
256255
if PYTHON is None:
257256
return
258-
args = [PYTHON, '-m', 'compileall', '-f', dfn]
257+
258+
if int(PYTHON_VERSION[0]) >= 3:
259+
args = [PYTHON, '-m', 'compileall', '-b', '-f', dfn]
260+
else:
261+
args = [PYTHON, '-m', 'compileall', '-f', dfn]
259262
if optimize_python:
263+
# -OO = strip docstrings
260264
args.insert(1, '-OO')
261265
subprocess.call(args)
262266

0 commit comments

Comments
 (0)