@@ -491,6 +491,9 @@ def parse_args(args=None):
491
491
'NAME:PATH_TO_PY[:foreground]' )
492
492
ap .add_argument ('--add-source' , dest = 'extra_source_dirs' , action = 'append' ,
493
493
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.' )
494
497
ap .add_argument ('--no-compile-pyo' , dest = 'no_compile_pyo' , action = 'store_true' ,
495
498
help = 'Do not optimise .py files to .pyo.' )
496
499
ap .add_argument ('--sign' , action = 'store_true' ,
@@ -524,6 +527,18 @@ def parse_args(args=None):
524
527
if args .services is None :
525
528
args .services = []
526
529
530
+ if args .try_system_python_compile :
531
+ # Hardcoding python2.7 is okay for now, as python3 skips the
532
+ # compilation anyway
533
+ if not exists ('crystax_python' ):
534
+ python_executable = 'python2.7'
535
+ try :
536
+ subprocess .call ([python_executable , '--version' ])
537
+ except (OSError , subprocess .CalledProcessError ):
538
+ pass
539
+ else :
540
+ PYTHON = python_executable
541
+
527
542
if args .no_compile_pyo :
528
543
PYTHON = None
529
544
BLACKLIST_PATTERNS .remove ('*.py' )
0 commit comments