Chromium Code Reviews| Index: tools/submit_try |
| =================================================================== |
| --- tools/submit_try (revision 8147) |
| +++ tools/submit_try (working copy) |
| @@ -13,22 +13,31 @@ |
| """ |
| -from contextlib import closing |
| - |
| import httplib |
| import json |
| import os |
| import subprocess |
| import sys |
| -import urllib2 |
| +if os.name == 'nt': |
| + SVN = 'svn.bat' |
| +else: |
| + SVN = 'svn' |
| + |
| + |
| def GetGlobalVariables(): |
| """ Retrieve a global variable from the global_variables.json file. """ |
| global_variables_file = ('http://skia.googlecode.com/svn/buildbot/' |
| 'site_config/global_variables.json') |
| - with closing(urllib2.urlopen(global_variables_file)) as f: |
| - return json.load(f) |
| + proc = subprocess.Popen([SVN, 'cat', global_variables_file], |
|
epoger
2013/03/14 14:51:41
It seems silly to have this subprocess-launching b
borenet
2013/03/14 17:18:05
Done.
|
| + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
| + exitcode = proc.wait() |
| + if not exitcode == 0: |
| + raise Exception('Could not retrieve global variables file from %s. ' |
| + 'Check your connection.' % global_variables_file) |
| + global_variables = proc.communicate()[0] |
| + return json.loads(global_variables) |
|
epoger
2013/03/14 14:51:41
should be json.load() instead of json.loads() ?
s
epoger
2013/03/14 14:54:49
Oh, I see this part is actually fine. Sorry about
borenet
2013/03/14 17:18:05
Removed the whole function, since it shouldn't get
|
| GLOBAL_VARIABLES = GetGlobalVariables() |
| @@ -79,8 +88,7 @@ |
| a git checkout. |
| """ |
| if is_svn: |
| - svn_cmd = 'svn.bat' if os.name == 'nt' else 'svn' |
| - cmd = [svn_cmd, 'info'] |
| + cmd = [SVN, 'info'] |
| proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
| stderr=subprocess.STDOUT) |
| if proc.wait() != 0: |