Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: utils.py

Issue 5915403922440192: Issue 2235 - Update jsshell to ESR31 to support new generator syntax (Closed)
Patch Set: Created March 31, 2015, 1:54 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This Source Code is subject to the terms of the Mozilla Public License 3 # This Source Code is subject to the terms of the Mozilla Public License
4 # version 2.0 (the "License"). You can obtain a copy of the License at 4 # version 2.0 (the "License"). You can obtain a copy of the License at
5 # http://mozilla.org/MPL/2.0/. 5 # http://mozilla.org/MPL/2.0/.
6 6
7 import sys, os, urllib, zipfile 7 import sys, os, urllib, zipfile
8 from StringIO import StringIO 8 from StringIO import StringIO
9 9
10 def ensureJSShell(): 10 def ensureJSShell():
11 baseDir = os.path.dirname(__file__) 11 baseDir = os.path.dirname(__file__)
12 shell_dir = os.path.join(baseDir, 'mozilla') 12 shell_dir = os.path.join(baseDir, 'mozilla')
13 if not os.path.exists(shell_dir): 13 if not os.path.exists(shell_dir):
14 os.makedirs(shell_dir) 14 os.makedirs(shell_dir)
15 if sys.platform == 'win32': 15 if sys.platform == 'win32':
16 path = os.path.join(shell_dir, 'js.exe') 16 path = os.path.join(shell_dir, 'js.exe')
17 else: 17 else:
18 path = os.path.join(shell_dir, 'js') 18 path = os.path.join(shell_dir, 'js')
19 if os.path.exists(path): 19 if os.path.exists(path):
20 return path 20 return path
21 21
22 platform_map = { 22 platform_map = {
23 'win32': 'win32', 23 'win32': 'win32',
24 'linux2': 'linux-i686', 24 'linux2': 'linux-i686',
25 'darwin': 'mac', 25 'darwin': 'mac',
26 } 26 }
27 if sys.platform not in platform_map: 27 if sys.platform not in platform_map:
28 raise Exception('Unknown platform, is there a JS shell version for it?') 28 raise Exception('Unknown platform, is there a JS shell version for it?')
29 29
30 download_url = 'https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/0 4/2014-04-14-00-05-01-mozilla-esr24/jsshell-%s.zip' % platform_map[sys.platform] 30 download_url = 'https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2015/0 3/2015-03-29-mozilla-esr31-debug/jsshell-%s.zip' % platform_map[sys.platform]
Wladimir Palant 2015/03/31 14:28:37 Using a debug build isn't a great idea. How about
Sebastian Noack 2015/03/31 17:54:23 Sure. I just didn't find a non-debug esr31 build,
31 data = StringIO(urllib.urlopen(download_url).read()) 31 data = StringIO(urllib.urlopen(download_url).read())
32 zip = zipfile.ZipFile(data) 32 zip = zipfile.ZipFile(data)
33 zip.extractall(shell_dir) 33 zip.extractall(shell_dir)
34 zip.close() 34 zip.close()
35 35
36 if not os.path.exists(path): 36 if not os.path.exists(path):
37 raise Exception('Downloaded package didn\'t contain JS shell executable') 37 raise Exception('Downloaded package didn\'t contain JS shell executable')
38 38
39 try: 39 try:
40 os.chmod(path, 0700) 40 os.chmod(path, 0700)
41 except: 41 except:
42 pass 42 pass
43 43
44 return path 44 return path
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld