diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-10-05 09:49:51 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-10-05 09:49:51 -0700 |
commit | 252869f1624d58c90bcc9748464b3034dbc566da (patch) | |
tree | 8890c4e2d7c15ce74dfbfcda43bfd14314eb71b2 | |
parent | 734b1450b5dc644065bd8705a5f1a7b8074cbc61 (diff) | |
parent | 19a52a996de0adb1ea598ff1ae112923f3e33fd2 (diff) |
Merge pull request #86 from SiggyBar/master
Misc fixes to make emscripten run (better) on Windows
-rw-r--r-- | AUTHORS | 1 | ||||
-rwxr-xr-x | emscripten.py | 10 | ||||
-rw-r--r-- | tests/runner.py | 13 | ||||
-rwxr-xr-x | tools/bindings_generator.py | 4 | ||||
-rwxr-xr-x | tools/dead_function_eliminator.py | 4 | ||||
-rwxr-xr-x | tools/emmaken.py | 4 | ||||
-rwxr-xr-x | tools/emmakenxx.py | 4 | ||||
-rwxr-xr-x | tools/exec_llvm.py | 4 | ||||
-rw-r--r-- | tools/shared.py | 4 |
9 files changed, 26 insertions, 22 deletions
@@ -4,3 +4,4 @@ under the licensing terms detailed in LICENSE. * Alon Zakai <alonzakai@gmail.com> (copyright owned by Mozilla Foundation) * Tim Dawborn <tim.dawborn@gmail.com> * Max Shawabkeh <max99x@gmail.com> +* Sigmund Vik <sigmund_vik@yahoo.com> diff --git a/emscripten.py b/emscripten.py index 022068c8..717865ef 100755 --- a/emscripten.py +++ b/emscripten.py @@ -18,10 +18,12 @@ GCC_DATA_LAYOUT = ('target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16' '-v128:128:128-a0:0:64-f80:32:32-f128:128:128-n8:16:32"') -def path_from_root(*target): - """Returns the absolute path to the target from the emscripten root.""" - abspath = os.path.abspath(os.path.dirname(__file__)) - return os.path.join(os.path.sep, *(abspath.split(os.sep) + list(target))) +def path_from_root(*pathelems): + """Returns the absolute path for which the given path elements are + relative to the emscripten root. + """ + rootpath = os.path.abspath(os.path.dirname(__file__)) + return os.path.join(rootpath, *pathelems) def get_temp_file(suffix): diff --git a/tests/runner.py b/tests/runner.py index ee51238f..5d227c7b 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -9,9 +9,9 @@ import os, unittest, tempfile, shutil, time, inspect, sys, math, glob, tempfile, # Setup -abspath = os.path.abspath(os.path.dirname(__file__)) def path_from_root(*pathelems): - return os.path.join(os.path.sep, *(abspath.split(os.sep)[:-1] + list(pathelems))) + rootpath = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) + return os.path.join(rootpath, *pathelems) exec(open(path_from_root('tools', 'shared.py'), 'r').read()) # Sanity check for config @@ -185,7 +185,7 @@ class RunnerCore(unittest.TestCase): except: pass settings = ['-s %s=%s' % (k, json.dumps(v)) for k, v in exported_settings.items()] - compiler_output = timeout_run(Popen([EMSCRIPTEN, filename + ('.o.ll' if append_ext else ''), '-o', filename + '.o.js'] + settings + extra_args, stdout=PIPE, stderr=STDOUT), TIMEOUT, 'Compiling') + compiler_output = timeout_run(Popen(['python', EMSCRIPTEN, filename + ('.o.ll' if append_ext else ''), '-o', filename + '.o.js'] + settings + extra_args, stdout=PIPE, stderr=STDOUT), TIMEOUT, 'Compiling') #print compiler_output # Detect compilation crashes and errors @@ -3983,7 +3983,7 @@ class %s(T): def setUp(self): global COMPILER, QUANTUM_SIZE, RELOOP, OPTIMIZE, ASSERTIONS, USE_TYPED_ARRAYS, LLVM_OPTS, SAFE_HEAP, CHECK_OVERFLOWS, CORRECT_OVERFLOWS, CORRECT_OVERFLOWS_LINES, CORRECT_SIGNS, CORRECT_SIGNS_LINES, CHECK_SIGNS, COMPILER_TEST_OPTS, CORRECT_ROUNDINGS, CORRECT_ROUNDINGS_LINES, INVOKE_RUN, SAFE_HEAP_LINES, INIT_STACK, AUTO_OPTIMIZE, RUNTIME_TYPE_INFO, DISABLE_EXCEPTIONS - COMPILER = '%s' + COMPILER = %r llvm_opts = %d embetter = %d quantum_size = %d @@ -4028,7 +4028,7 @@ TT = %s fullname = '%s_%d_%d%s%s' % ( name, llvm_opts, embetter, '' if quantum == 4 else '_q' + str(quantum), '' if typed_arrays in [0, 1] else '_t' + str(typed_arrays) ) - exec('%s = make_test("%s","%s",%d,%d,%d,%d)' % (fullname, fullname, compiler, llvm_opts, embetter, quantum, typed_arrays)) + exec('%s = make_test(%r,%r,%d,%d,%d,%d)' % (fullname, fullname, compiler, llvm_opts, embetter, quantum, typed_arrays)) del T # T is just a shape for the specific subclasses, we don't test it itself @@ -4244,7 +4244,8 @@ else: if __name__ == '__main__': sys.argv = [sys.argv[0]] + ['-v'] + sys.argv[1:] # Verbose output by default for cmd in [CLANG, LLVM_GCC, LLVM_DIS, SPIDERMONKEY_ENGINE[0], V8_ENGINE[0]]: - if not os.path.exists(cmd): + if not os.path.exists(cmd) and \ + not os.path.exists(cmd + '.exe'): # .exe extension required for Windows print 'WARNING: Cannot find', cmd unittest.main() diff --git a/tools/bindings_generator.py b/tools/bindings_generator.py index 0a1a75cc..4c4bfd3d 100755 --- a/tools/bindings_generator.py +++ b/tools/bindings_generator.py @@ -47,9 +47,9 @@ NOTE: ammo.js is currently the biggest consumer of this code. For some import os, sys, glob, re -abspath = os.path.abspath(os.path.dirname(__file__)) def path_from_root(*pathelems): - return os.path.join(os.path.sep, *(abspath.split(os.sep)[:-1] + list(pathelems))) + rootpath = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) + return os.path.join(rootpath, *pathelems) exec(open(path_from_root('tools', 'shared.py'), 'r').read()) # Find ply and CppHeaderParser diff --git a/tools/dead_function_eliminator.py b/tools/dead_function_eliminator.py index d6f96536..9106f8b7 100755 --- a/tools/dead_function_eliminator.py +++ b/tools/dead_function_eliminator.py @@ -11,9 +11,9 @@ to remove them before Emscripten runs. import os, sys, re -abspath = os.path.abspath(os.path.dirname(__file__)) def path_from_root(*pathelems): - return os.path.join(os.path.sep, *(abspath.split(os.sep)[:-1] + list(pathelems))) + rootpath = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) + return os.path.join(rootpath, *pathelems) exec(open(path_from_root('tools', 'shared.py'), 'r').read()) infile = sys.argv[1] diff --git a/tools/emmaken.py b/tools/emmaken.py index 76c2e9c8..c04aaf30 100755 --- a/tools/emmaken.py +++ b/tools/emmaken.py @@ -59,9 +59,9 @@ import subprocess print >> sys.stderr, 'emmaken.py: ', ' '.join(sys.argv) -abspath = os.path.abspath(os.path.dirname(__file__)) def path_from_root(*pathelems): - return os.path.join(os.path.sep, *(abspath.split(os.sep)[:-1] + list(pathelems))) + rootpath = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) + return os.path.join(rootpath, *pathelems) exec(open(path_from_root('tools', 'shared.py'), 'r').read()) # If this is a configure-type thing, just do that diff --git a/tools/emmakenxx.py b/tools/emmakenxx.py index e271d765..f473a8bf 100755 --- a/tools/emmakenxx.py +++ b/tools/emmakenxx.py @@ -6,9 +6,9 @@ see emmaken.py import os, sys -abspath = os.path.abspath(os.path.dirname(__file__)) def path_from_root(*pathelems): - return os.path.join(os.path.sep, *(abspath.split(os.sep)[:-1] + list(pathelems))) + rootpath = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) + return os.path.join(rootpath, *pathelems) exec(open(path_from_root('tools', 'shared.py'), 'r').read()) emmaken = path_from_root('tools', 'emmaken.py') diff --git a/tools/exec_llvm.py b/tools/exec_llvm.py index aa18aa2b..840966e6 100755 --- a/tools/exec_llvm.py +++ b/tools/exec_llvm.py @@ -36,9 +36,9 @@ the .ll into native code. This can be done as follows: import os, sys from subprocess import Popen, PIPE, STDOUT -abspath = os.path.abspath(os.path.dirname(__file__)) def path_from_root(*pathelems): - return os.path.join(os.path.sep, *(abspath.split(os.sep)[:-1] + list(pathelems))) + rootpath = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) + return os.path.join(rootpath, *pathelems) exec(open(path_from_root('tools', 'shared.py'), 'r').read()) print '// EXEC_LLVM: ', sys.argv diff --git a/tools/shared.py b/tools/shared.py index 83c921da..4b68555a 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -1,9 +1,9 @@ import shutil, time, os from subprocess import Popen, PIPE, STDOUT -abspath = os.path.abspath(os.path.dirname(__file__)) def path_from_root(*pathelems): - return os.path.join(os.path.sep, *(abspath.split(os.sep)[:-1] + list(pathelems))) + rootpath = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) + return os.path.join(rootpath, *pathelems) CONFIG_FILE = os.path.expanduser('~/.emscripten') if not os.path.exists(CONFIG_FILE): |