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

Delta Between Two Patch Sets: abp_rewrite.py

Issue 29350244: Issue 4374 - Made Python code part of jshydra comply with our coding practices (Closed)
Left Patch Set: Merge abp_rewrite and utils module Created Aug. 28, 2016, 10:43 p.m.
Right Patch Set: Rebased and fixed typo Created Aug. 30, 2016, 12:01 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | autotest.py » ('j') | autotest.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
5 from __future__ import print_function
6 4
7 import os 5 import os
8 import platform 6 import platform
Sebastian Noack 2016/08/28 22:51:56 All I did with patchset #2 is removing utils.py an
9 import io 7 import io
10 import zipfile 8 import zipfile
11 import subprocess 9 import subprocess
12 10
13 try: 11 try:
14 from urllib.request import urlopen 12 from urllib.request import urlopen
15 except ImportError: 13 except ImportError:
16 import urllib 14 import urllib2
17 import contextlib 15 import contextlib
18 16
19 def urlopen(*args, **kwargs): 17 def urlopen(*args, **kwargs):
20 return contextlib.closing(urllib.urlopen(*args, **kwargs)) 18 return contextlib.closing(urllib2.urlopen(*args, **kwargs))
21 19
22 JSSHELL_DIR = 'mozilla-esr31' 20 JSSHELL_DIR = 'mozilla-esr31'
23 JSSHELL_URL = ('https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly' 21 JSSHELL_URL = ('https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly'
24 '/2015/02/2015-02-25-00-22-19-{}' 22 '/2015/02/2015-02-25-00-22-19-{}'
25 '/jsshell-{{}}.zip'.format(JSSHELL_DIR)) 23 '/jsshell-{{}}.zip'.format(JSSHELL_DIR))
26 24
27 JSSHELL_SUPPORTED_PLATFORMS = { 25 JSSHELL_SUPPORTED_PLATFORMS = {
28 'Windows': 'win32', 26 'Windows': 'win32',
29 'Linux': { 27 'Linux': {
30 'i686': 'linux-i686', 28 'i686': 'linux-i686',
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 def rewrite_js(args, script=None): 79 def rewrite_js(args, script=None):
82 jsshell = ensure_jsshell() 80 jsshell = ensure_jsshell()
83 env = {'LD_LIBRARY_PATH': os.path.relpath(os.path.dirname(jsshell))} 81 env = {'LD_LIBRARY_PATH': os.path.relpath(os.path.dirname(jsshell))}
84 base_dir = os.path.dirname(__file__) 82 base_dir = os.path.dirname(__file__)
85 83
86 if not script: 84 if not script:
87 script = os.path.join(base_dir, 'scripts', 'abprewrite.js') 85 script = os.path.join(base_dir, 'scripts', 'abprewrite.js')
88 86
89 command = [jsshell, os.path.join(base_dir, 'jshydra.js'), script] + args 87 command = [jsshell, os.path.join(base_dir, 'jshydra.js'), script] + args
90 return subprocess.check_output(command, env=env, universal_newlines=True) 88 return subprocess.check_output(command, env=env, universal_newlines=True)
LEFTRIGHT
« no previous file | autotest.py » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld