OLD | NEW |
1 # This Source Code is subject to the terms of the Mozilla Public License | 1 # This Source Code is subject to the terms of the Mozilla Public License |
2 # version 2.0 (the "License"). You can obtain a copy of the License at | 2 # version 2.0 (the "License"). You can obtain a copy of the License at |
3 # http://mozilla.org/MPL/2.0/. | 3 # http://mozilla.org/MPL/2.0/. |
4 | 4 |
5 from __future__ import print_function | 5 from __future__ import print_function |
6 | 6 |
7 import os | 7 import os |
8 import subprocess | 8 import subprocess |
9 | 9 |
10 import utils | 10 import utils |
11 | 11 |
12 | 12 |
13 def rewrite_js(args, script=None): | 13 def rewrite_js(args, script=None): |
14 jsshell = utils.ensureJSShell() | 14 jsshell = utils.ensure_jsshell() |
15 env = {'LD_LIBRARY_PATH': os.path.relpath(os.path.dirname(jsshell))} | 15 env = {'LD_LIBRARY_PATH': os.path.relpath(os.path.dirname(jsshell))} |
16 base_dir = os.path.dirname(__file__) | 16 base_dir = os.path.dirname(__file__) |
17 | 17 |
18 if not script: | 18 if not script: |
19 script = os.path.join(base_dir, 'scripts', 'abprewrite.js') | 19 script = os.path.join(base_dir, 'scripts', 'abprewrite.js') |
20 | 20 |
21 command = [jsshell, os.path.join(base_dir, 'jshydra.js'), script] + args | 21 command = [jsshell, os.path.join(base_dir, 'jshydra.js'), script] + args |
22 return subprocess.check_output(command, env=env, universal_newlines=True) | 22 return subprocess.check_output(command, env=env, universal_newlines=True) |
OLD | NEW |