aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Kligman <alan.kligman@gmail.com>2012-12-02 17:55:21 -0500
committerAlan Kligman <alan.kligman@gmail.com>2012-12-19 18:06:48 -0500
commita2bc9a30de6c541b399d267471cf984a6998f30c (patch)
tree0e3abb4aea8de8f4c74fc48f6a9f884f2923ea6c
parent14077b986818ee3da10ae8488eea5000276a10ea (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.
-rwxr-xr-xem++2
-rwxr-xr-xemcc12
-rwxr-xr-xtools/emmakenxx.py2
-rw-r--r--tools/shared.py14
4 files changed, 18 insertions, 12 deletions
diff --git a/em++ b/em++
index 459ff2b2..ba09e1a2 100755
--- a/em++
+++ b/em++
@@ -8,5 +8,5 @@ import os, subprocess, sys
from tools import shared
os.environ['EMMAKEN_CXX'] = '1'
-exit(subprocess.call(['python2', shared.EMCC] + sys.argv[1:]))
+exit(subprocess.call([shared.PYTHON, shared.EMCC] + sys.argv[1:]))
diff --git a/emcc b/emcc
index 71faf08d..e0372e4d 100755
--- a/emcc
+++ b/emcc
@@ -925,9 +925,9 @@ try:
# dlmalloc
def create_dlmalloc():
if DEBUG: print >> sys.stderr, 'emcc: building dlmalloc for cache'
- execute(shared.ENV_PREFIX + ['python2', shared.EMCC, shared.path_from_root('system', 'lib', 'dlmalloc.c'), '-g', '-o', in_temp('dlmalloc.o')], stdout=stdout, stderr=stderr)
+ execute([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', 'dlmalloc.c'), '-g', '-o', in_temp('dlmalloc.o')], stdout=stdout, stderr=stderr)
# we include the libc++ new stuff here, so that the common case of using just new/delete is quick to link
- execute(shared.ENV_PREFIX + ['python2', shared.EMXX, shared.path_from_root('system', 'lib', 'libcxx', 'new.cpp'), '-g', '-o', in_temp('new.o')], stdout=stdout, stderr=stderr)
+ execute([shared.PYTHON, shared.EMXX, shared.path_from_root('system', 'lib', 'libcxx', 'new.cpp'), '-g', '-o', in_temp('new.o')], stdout=stdout, stderr=stderr)
shared.Building.link([in_temp('dlmalloc.o'), in_temp('new.o')], in_temp('dlmalloc_full.o'))
return in_temp('dlmalloc_full.o')
def fix_dlmalloc():
@@ -950,7 +950,7 @@ try:
os = []
for src in ['algorithm.cpp', 'condition_variable.cpp', 'future.cpp', 'iostream.cpp', 'memory.cpp', 'random.cpp', 'stdexcept.cpp', 'system_error.cpp', 'utility.cpp', 'bind.cpp', 'debug.cpp', 'hash.cpp', 'mutex.cpp', 'string.cpp', 'thread.cpp', 'valarray.cpp', 'chrono.cpp', 'exception.cpp', 'ios.cpp', 'locale.cpp', 'regex.cpp', 'strstream.cpp', 'typeinfo.cpp']:
o = in_temp(src + '.o')
- execute(shared.ENV_PREFIX + ['python2', shared.EMXX, shared.path_from_root('system', 'lib', 'libcxx', src), '-o', o], stdout=stdout, stderr=stderr)
+ execute([shared.PYTHON, shared.EMXX, shared.path_from_root('system', 'lib', 'libcxx', src), '-o', o], stdout=stdout, stderr=stderr)
os.append(o)
shared.Building.link(os, in_temp('libcxx.bc'))
return in_temp('libcxx.bc')
@@ -969,7 +969,7 @@ try:
os = []
for src in ['private_typeinfo.cpp']:
o = in_temp(src + '.o')
- execute(shared.ENV_PREFIX + ['python2', shared.EMXX, shared.path_from_root('system', 'lib', 'libcxxabi', 'src', src), '-o', o], stdout=stdout, stderr=stderr)
+ execute([shared.PYTHON, shared.EMXX, shared.path_from_root('system', 'lib', 'libcxxabi', 'src', src), '-o', o], stdout=stdout, stderr=stderr)
os.append(o)
shared.Building.link(os, in_temp('libcxxabi.bc'))
return in_temp('libcxxabi.bc')
@@ -1075,7 +1075,7 @@ try:
if AUTODEBUG:
if DEBUG: print >> sys.stderr, 'emcc: autodebug'
- execute(shared.ENV_PREFIX + ['python2', shared.AUTODEBUGGER, final, final + '.ad.ll'])
+ execute([shared.PYTHON, shared.AUTODEBUGGER, final, final + '.ad.ll'])
final += '.ad.ll'
if DEBUG: save_intermediate('autodebug', 'll')
@@ -1098,7 +1098,7 @@ try:
file_args += embed_files
if Compression.on:
file_args += ['--compress', Compression.encoder, Compression.decoder, Compression.js_name]
- code = execute(shared.ENV_PREFIX + ['python2', shared.FILE_PACKAGER, unsuffixed(target) + '.data'] + file_args, stdout=PIPE)[0]
+ code = execute([shared.PYTHON, shared.FILE_PACKAGER, unsuffixed(target) + '.data'] + file_args, stdout=PIPE)[0]
src = open(final).read().replace('// {{PRE_RUN_ADDITIONS}}', '// {{PRE_RUN_ADDITIONS}}\n' + code)
final += '.files.js'
open(final, 'w').write(src)
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