8000 Fix python3's `compileall` command for build.py file · opacam/python-for-android@d6a927c · GitHub
[go: up one dir, main page]

Skip to content

Commit d6a927c

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 42f89d2 commit d6a927c

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
@@ -253,11 +253,15 @@ def compile_dir(dfn, optimize_python=True):
253253
if get_bootstrap_name() != "sdl2":
254254
# HISTORICALLY DISABLED for other than sdl2. NEEDS REVIEW! -JonasT
255255
return
256-
# -OO = strip docstrings
257256
if PYTHON is None:
258257
return
259-
args = [PYTHON, '-m', 'compileall', '-f', dfn]
258+
259+
if int(PYTHON_VERSION[0]) >= 3:
260+
args = [PYTHON, '-m', 'compileall', '-b', '-f', dfn]
261+
else:
262+
args = [PYTHON, '-m', 'compileall', '-f', dfn]
260263
if optimize_python:
264+
# -OO = strip docstrings
261265
args.insert(1, '-OO')
262266
subprocess.call(args)
263267

0 commit comments

Comments
 (0)
0