diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2013-09-10 23:52:18 +0300 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-09-11 10:33:47 +0300 |
commit | 9b85e4b330eea119ce445f5a0c1fdafa7095e9f9 (patch) | |
tree | d09cc466833c8a9638cae242a8a7318f55ca0583 | |
parent | 75413a5f7814105aab478238767decbdc7d4e12e (diff) |
Use SPIDERMONKEY_ENGINE from ~/.emscripten in validate_asmjs.py as the primary source for locating SpiderMonkey. If it was not set appropriately, look from PATH.
-rw-r--r-- | tools/validate_asmjs.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/validate_asmjs.py b/tools/validate_asmjs.py index 85bf69ce..ea909fbd 100644 --- a/tools/validate_asmjs.py +++ b/tools/validate_asmjs.py @@ -12,10 +12,20 @@ # This script depends on the SpiderMonkey JS engine, which must be present in PATH in order for this script to function. import subprocess, sys, re, tempfile, os, time +import shared + +# Looks up SpiderMonkey engine using the variable SPIDERMONKEY_ENGINE in ~/.emscripten, and if not set up there, via PATH. +def find_spidermonkey_engine(): + sm_engine = shared.SPIDERMONKEY_ENGINE if hasattr(shared, 'SPIDERMONKEY_ENGINE') else [''] + if not sm_engine or len(sm_engine[0]) == 0 or not os.path.exists(sm_engine[0]): + sm_engine[0] = shared.Building.which('js') + if sm_engine[0] == None: + return ['js-not-found'] + return sm_engine # Given a .js file, returns True/False depending on if that file is valid asm.js def validate_asmjs_jsfile(filename, muteOutput): - process = subprocess.Popen(['js', '-c', filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) + process = subprocess.Popen(find_spidermonkey_engine() + ['-c', filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) (stdout, stderr) = process.communicate() if not muteOutput: if len(stdout.strip()) > 0: |