aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-31 14:11:57 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-31 14:11:57 -0800
commit2761fe8d19002c94aa25d92246fc9968ba7c2cac (patch)
treed2c4eb386d071f96330ce5de55ed79c815734efd /tools
parentab7dacbf6278ad1cbe1633231d1c04abaa80b702 (diff)
parentd48cba10976ff7665fb39768ca251c8f08e1bbe8 (diff)
Merge pull request #198 from ehsan/import_shared_properly
Import shared.py properly
Diffstat (limited to 'tools')
-rwxr-xr-xtools/bindings_generator.py5
-rwxr-xr-xtools/emconfiguren.py5
-rwxr-xr-xtools/emmaken.py10
-rwxr-xr-xtools/emmakenxx.py5
-rwxr-xr-xtools/exec_llvm.py5
5 files changed, 18 insertions, 12 deletions
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]