Skip to content

Commit dd965f8

Browse files
committed
Added option to compileall with system python instead of hostpython
1 parent c94f553 commit dd965f8

File tree

1 file changed

+14
-0
lines changed
  • pythonforandroid/bootstraps/sdl2/build

1 file changed

+14
-0
lines changed

pythonforandroid/bootstraps/sdl2/build/build.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,9 @@ def parse_args(args=None):
491491
'NAME:PATH_TO_PY[:foreground]')
492492
ap.add_argument('--add-source', dest='extra_source_dirs', action='append',
493493
help='Include additional source dirs in Java build')
494+
ap.add_argument('--try-system-python-compile', dest='try_system_python_compile',
495+
action='store_true',
496+
help='Use the system python during compileall if possible.')
494497
ap.add_argument('--no-compile-pyo', dest='no_compile_pyo', action='store_true',
495498
help='Do not optimise .py files to .pyo.')
496499
ap.add_argument('--sign', action='store_true',
@@ -524,6 +527,17 @@ def parse_args(args=None):
524527
if args.services is None:
525528
args.services = []
526529

530+
if args.try_system_python_compile:
531+
# Hardcoding python2.7 is okay for now, as python3 skips the
532+
# compilation anyway
533+
python_executable = 'python2.7'
534+
try:
535+
subprocess.call([python_executable, '--version'])
536+
except (OSError, subprocess.CalledProcessError):
537+
pass
538+
else:
539+
PYTHON = python_executable
540+
527541
if args.no_compile_pyo:
528542
PYTHON = None
529543
BLACKLIST_PATTERNS.remove('*.py')

0 commit comments

Comments
 (0)