diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-01-31 14:11:57 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-01-31 14:11:57 -0800 |
commit | 2761fe8d19002c94aa25d92246fc9968ba7c2cac (patch) | |
tree | d2c4eb386d071f96330ce5de55ed79c815734efd | |
parent | ab7dacbf6278ad1cbe1633231d1c04abaa80b702 (diff) | |
parent | d48cba10976ff7665fb39768ca251c8f08e1bbe8 (diff) |
Merge pull request #198 from ehsan/import_shared_properly
Import shared.py properly
-rwxr-xr-x | emcc | 5 | ||||
-rwxr-xr-x | tests/runner.py | 8 | ||||
-rw-r--r-- | third_party/demangler.py | 5 | ||||
-rwxr-xr-x | tools/bindings_generator.py | 5 | ||||
-rwxr-xr-x | tools/emconfiguren.py | 5 | ||||
-rwxr-xr-x | tools/emmaken.py | 10 | ||||
-rwxr-xr-x | tools/emmakenxx.py | 5 | ||||
-rwxr-xr-x | tools/exec_llvm.py | 5 |
8 files changed, 29 insertions, 19 deletions
@@ -41,10 +41,11 @@ Example uses: * For SCons the shared.py can be imported like so: __file__ = str(Dir('#/project_path_to_emscripten/dummy/dummy')) - __rootpath__ = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) + __rootpath__ = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) def path_from_root(*pathelems): return os.path.join(__rootpath__, *pathelems) - exec(open(path_from_root('tools', 'shared.py'), 'r').read()) + sys.path += [path_from_root('')] + from tools.shared import * For using the Emscripten compilers/linkers/etc. you can do: env = Environment() diff --git a/tests/runner.py b/tests/runner.py index ad411ee1..4bf8f008 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -18,12 +18,12 @@ import os, unittest, tempfile, shutil, time, inspect, sys, math, glob, tempfile, # Setup -__rootpath__ = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) +__rootpath__ = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) def path_from_root(*pathelems): return os.path.join(__rootpath__, *pathelems) -exec(open(path_from_root('tools', 'shared.py'), 'r').read()) - sys.path += [path_from_root('')] +import tools.shared +from tools.shared import * # Sanity check for config @@ -41,7 +41,9 @@ class RunnerCore(unittest.TestCase): # Change this to None to get stderr reporting, for debugging purposes def setUp(self): + global Settings Settings.reset() + Settings = tools.shared.Settings self.banned_js_engines = [] if not self.save_dir: dirname = tempfile.mkdtemp(prefix='emscripten_test_' + self.__class__.__name__ + '_', dir=TEMP_DIR) diff --git a/third_party/demangler.py b/third_party/demangler.py index d875d9a5..1066643b 100644 --- a/third_party/demangler.py +++ b/third_party/demangler.py @@ -21,10 +21,11 @@ JS_ENGINE_PARAMS=[] import os, sys, subprocess, re -__rootpath__ = os.path.abspath(os.path.dirname(__file__)) +__rootpath__ = os.path.dirname(os.path.abspath(__file__)) def path_from_root(*pathelems): return os.path.join(os.path.sep, *(__rootpath__.split(os.sep)[:-1] + list(pathelems))) -exec(open(path_from_root('tools', 'shared.py'), 'r').read()) +sys.path += [path_from_root('')] +from tools.shared import * data = open(sys.argv[1], 'r').readlines() diff --git a/tools/bindings_generator.py b/tools/bindings_generator.py index 0dbcca8e..8146215c 100755 --- a/tools/bindings_generator.py +++ b/tools/bindings_generator.py @@ -50,10 +50,11 @@ NOTE: ammo.js is currently the biggest consumer of this code. For some import os, sys, glob, re -__rootpath__ = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) +__rootpath__ = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) def path_from_root(*pathelems): return os.path.join(__rootpath__, *pathelems) -exec(open(path_from_root('tools', 'shared.py'), 'r').read()) +sys.path += [path_from_root('')] +from tools.shared import * # Find ply and CppHeaderParser sys.path = [path_from_root('third_party', 'ply'), path_from_root('third_party', 'CppHeaderParser')] + sys.path diff --git a/tools/emconfiguren.py b/tools/emconfiguren.py index 2ea5669f..fd7b7549 100755 --- a/tools/emconfiguren.py +++ b/tools/emconfiguren.py @@ -9,10 +9,11 @@ This is a helper script for emmaken.py. See docs in that file for more info. import os, sys -__rootpath__ = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) +__rootpath__ = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) def path_from_root(*pathelems): return os.path.join(__rootpath__, *pathelems) -exec(open(path_from_root('tools', 'shared.py'), 'r').read()) +sys.path += [path_from_root('')] +from tools.shared import * Building.configure(sys.argv[1:]) diff --git a/tools/emmaken.py b/tools/emmaken.py index 447a7d6d..8e1bfdc8 100755 --- a/tools/emmaken.py +++ b/tools/emmaken.py @@ -56,10 +56,11 @@ Example uses: * For SCons the shared.py can be imported like so: __file__ = str(Dir('#/project_path_to_emscripten/dummy/dummy')) - __rootpath__ = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) + __rootpath__ = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) def path_from_root(*pathelems): return os.path.join(__rootpath__, *pathelems) - exec(open(path_from_root('tools', 'shared.py'), 'r').read()) + sys.path += [path_from_root('')] + from tools.shared import * For using the Emscripten compilers/linkers/etc. you can do: env = Environment() @@ -99,10 +100,11 @@ import subprocess print >> sys.stderr, 'emmaken.py: ', ' '.join(sys.argv) -__rootpath__ = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) +__rootpath__ = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) def path_from_root(*pathelems): return os.path.join(__rootpath__, *pathelems) -exec(open(path_from_root('tools', 'shared.py'), 'r').read()) +sys.path += [path_from_root('')] +from tools.shared import * # If this is a configure-type thing, just do that CONFIGURE_CONFIG = os.environ.get('EMMAKEN_JUST_CONFIGURE') diff --git a/tools/emmakenxx.py b/tools/emmakenxx.py index 31658df2..c9ab4ef4 100755 --- a/tools/emmakenxx.py +++ b/tools/emmakenxx.py @@ -6,10 +6,11 @@ see emmaken.py import os, sys -__rootpath__ = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) +__rootpath__ = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) def path_from_root(*pathelems): return os.path.join(__rootpath__, *pathelems) -exec(open(path_from_root('tools', 'shared.py'), 'r').read()) +sys.path += [path_from_root('')] +from tools.shared import * emmaken = path_from_root('tools', 'emmaken.py') os.environ['EMMAKEN_CXX'] = '1' diff --git a/tools/exec_llvm.py b/tools/exec_llvm.py index 1b1bba1b..a2a000f0 100755 --- a/tools/exec_llvm.py +++ b/tools/exec_llvm.py @@ -36,10 +36,11 @@ the .ll into native code. This can be done as follows: import os, sys from subprocess import Popen, PIPE, STDOUT -__rootpath__ = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) +__rootpath__ = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) def path_from_root(*pathelems): return os.path.join(__rootpath__, *pathelems) -exec(open(path_from_root('tools', 'shared.py'), 'r').read()) +sys.path += [path_from_root('')] +from tools.shared import * Popen([LLVM_OPT, sys.argv[1], '-strip-debug', '-o=' + sys.argv[1]+'.clean.bc']).communicate()[0] |