Index: lib/naclports/util.py |
diff --git a/lib/naclports/util.py b/lib/naclports/util.py |
index dc57cea287ddfa695e723e8ed2c71b10981fa6f1..881ef07a4a34b8cb87e20dbd6f51cd6663a2edb5 100644 |
--- a/lib/naclports/util.py |
+++ b/lib/naclports/util.py |
@@ -250,6 +250,26 @@ def GetEmscriptenRoot(): |
return emscripten |
+def SetupEmscripten(): |
+ if 'EMSCRIPTEN' in os.environ: |
+ return |
+ |
+ local_root = GetEmscriptenRoot() |
+ os.environ['EMSCRIPTEN'] = local_root |
+ os.environ['EM_CONFIG'] = os.path.join(os.path.dirname(local_root), |
+ '.emscripten') |
+ try: |
+ FindInPath('node') |
+ except error.Error: |
+ node_bin = os.path.join(paths.OUT_DIR, 'node', 'bin') |
+ if not os.path.isdir(node_bin): |
+ raise error.Error('node not found in path and default path not found: %s' |
+ % node_bin) |
+ |
+ os.environ['PATH'] += ':' + node_bin |
+ FindInPath('node') |
+ |
+ |
@Memoize |
def GetSDKVersion(): |
"""Returns the version (as a string) of the current SDK.""" |
@@ -278,7 +298,6 @@ def GetPlatform(): |
platform = subprocess.check_output([getos]).strip() |
return platform |
- |
@Memoize |
def GetToolchainRoot(config): |
"""Returns the toolchain folder for a given NaCl toolchain.""" |