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 import os | 5 import os |
6 import platform | 6 import platform |
7 import io | 7 import io |
8 import zipfile | 8 import zipfile |
9 import subprocess | 9 import subprocess |
10 | 10 |
11 try: | 11 try: |
12 from urllib.request import urlopen | 12 from urllib.request import urlopen |
13 except ImportError: | 13 except ImportError: |
14 import urllib2 | 14 import urllib2 |
15 import contextlib | 15 import contextlib |
16 | 16 |
17 def urlopen(*args, **kwargs): | 17 def urlopen(*args, **kwargs): |
18 return contextlib.closing(urllib2.urlopen(*args, **kwargs)) | 18 return contextlib.closing(urllib2.urlopen(*args, **kwargs)) |
19 | 19 |
20 JSSHELL_DIR = 'mozilla-esr31' | 20 JSSHELL_DIR = 'mozilla-esr45' |
21 JSSHELL_URL = ('https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly' | 21 JSSHELL_URL = ('https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly' |
22 '/2015/02/2015-02-25-00-22-19-{}' | 22 '/2016/05/2016-05-29-00-15-03-{}' |
23 '/jsshell-{{}}.zip'.format(JSSHELL_DIR)) | 23 '/jsshell-{{}}.zip'.format(JSSHELL_DIR)) |
24 | 24 |
25 JSSHELL_SUPPORTED_PLATFORMS = { | 25 JSSHELL_SUPPORTED_PLATFORMS = { |
26 'Windows': 'win32', | 26 'Windows': 'win32', |
27 'Linux': { | 27 'Linux': { |
28 'i686': 'linux-i686', | 28 'i686': 'linux-i686', |
29 'x86_64': 'linux-x86_64' | 29 'x86_64': 'linux-x86_64' |
30 }, | 30 }, |
31 'Darwin': 'mac' | 31 'Darwin': 'mac' |
32 } | 32 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 def rewrite_js(args, script=None): | 79 def rewrite_js(args, script=None): |
80 jsshell = ensure_jsshell() | 80 jsshell = ensure_jsshell() |
81 env = {'LD_LIBRARY_PATH': os.path.relpath(os.path.dirname(jsshell))} | 81 env = {'LD_LIBRARY_PATH': os.path.relpath(os.path.dirname(jsshell))} |
82 base_dir = os.path.dirname(__file__) | 82 base_dir = os.path.dirname(__file__) |
83 | 83 |
84 if not script: | 84 if not script: |
85 script = os.path.join(base_dir, 'scripts', 'abprewrite.js') | 85 script = os.path.join(base_dir, 'scripts', 'abprewrite.js') |
86 | 86 |
87 command = [jsshell, os.path.join(base_dir, 'jshydra.js'), script] + args | 87 command = [jsshell, os.path.join(base_dir, 'jshydra.js'), script] + args |
88 return subprocess.check_output(command, env=env, universal_newlines=True) | 88 return subprocess.check_output(command, env=env, universal_newlines=True) |
OLD | NEW |