diff options
author | Alan Kligman <alan.kligman@gmail.com> | 2012-12-02 17:55:21 -0500 |
---|---|---|
committer | Alan Kligman <alan.kligman@gmail.com> | 2012-12-19 18:06:48 -0500 |
commit | a2bc9a30de6c541b399d267471cf984a6998f30c (patch) | |
tree | 0e3abb4aea8de8f4c74fc48f6a9f884f2923ea6c /tools | |
parent | 14077b986818ee3da10ae8488eea5000276a10ea (diff) |
Updated to add a PYTHON config option instead of defaulting to python2. This should preserve the default behavior in a way that can be overridden.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/emmakenxx.py | 2 | ||||
-rw-r--r-- | tools/shared.py | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/tools/emmakenxx.py b/tools/emmakenxx.py index 9f206284..0af3f99e 100755 --- a/tools/emmakenxx.py +++ b/tools/emmakenxx.py @@ -14,5 +14,5 @@ from tools.shared import * emmaken = path_from_root('tools', 'emmaken.py') os.environ['EMMAKEN_CXX'] = '1' -exit(subprocess.call(['python2', emmaken] + sys.argv[1:])) +exit(subprocess.call([PYTHON, emmaken] + sys.argv[1:])) diff --git a/tools/shared.py b/tools/shared.py index 499df793..dc3e2a30 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -319,6 +319,12 @@ except: CLOSURE_COMPILER = path_from_root('third_party', 'closure-compiler', 'compiler.jar') try: + PYTHON +except: + print >> sys.stderr, 'PYTHON not defined in ~/.emscripten, using "python"' + PYTHON = 'python' + +try: JAVA except: print >> sys.stderr, 'JAVA not defined in ~/.emscripten, using "java"' @@ -378,7 +384,7 @@ WINDOWS = sys.platform.startswith('win') ENV_PREFIX = [] if not WINDOWS: try: - assert 'Python' in Popen(['env', 'python2', '-V'], stdout=PIPE, stderr=STDOUT).communicate()[0] + assert 'Python' in Popen(['env', 'python', '-V'], stdout=PIPE, stderr=STDOUT).communicate()[0] ENV_PREFIX = ['env'] except: pass @@ -862,13 +868,13 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e if output_filename is None: output_filename = filename + '.o' try_delete(output_filename) - Popen(ENV_PREFIX + ['python2', EMCC, filename] + args + ['-o', output_filename], stdout=stdout, stderr=stderr, env=env).communicate() + Popen([PYTHON, EMCC, filename] + args + ['-o', output_filename], stdout=stdout, stderr=stderr, env=env).communicate() assert os.path.exists(output_filename), 'emcc could not create output file' @staticmethod def emar(action, output_filename, filenames, stdout=None, stderr=None, env=None): try_delete(output_filename) - Popen(ENV_PREFIX + ['python2', EMAR, action, output_filename] + filenames, stdout=stdout, stderr=stderr, env=env).communicate() + Popen([PYTHON, EMAR, action, output_filename] + filenames, stdout=stdout, stderr=stderr, env=env).communicate() if 'c' in action: assert os.path.exists(output_filename), 'emar could not create output file' @@ -879,7 +885,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e # Run Emscripten settings = Settings.serialize() - compiler_output = timeout_run(Popen(ENV_PREFIX + ['python2', EMSCRIPTEN, filename + ('.o.ll' if append_ext else ''), '-o', filename + '.o.js'] + settings + extra_args, stdout=PIPE), None, 'Compiling') + compiler_output = timeout_run(Popen([PYTHON, EMSCRIPTEN, filename + ('.o.ll' if append_ext else ''), '-o', filename + '.o.js'] + settings + extra_args, stdout=PIPE), None, 'Compiling') #print compiler_output # Detect compilation crashes and errors |