Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Unified Diff: trychange.py

Issue 1050005: Fix support with python 2.6 without simplejson. (Closed)
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trychange.py
diff --git a/trychange.py b/trychange.py
index 96f72b8689c7418e4a0268c7b9a94a74b5f54de2..85d589f0f1d8e64d4b4b4e87e7a5dcc3a281d6dd 100755
--- a/trychange.py
+++ b/trychange.py
@@ -21,6 +21,14 @@ import tempfile
import urllib
try:
+ import simplejson as json
+except ImportError:
+ try:
+ import json
+ except ImportError:
+ json = None
+
+try:
import breakpad
except ImportError:
pass
@@ -621,13 +629,11 @@ def TryChange(argv,
elif options.issue and options.patchset is None:
# Retrieve the patch from rietveld when the diff is not specified.
# When patchset is specified, it's because it's done by gcl/git-try.
- try:
- import simplejson
- except ImportError:
- parser.error('simplejson library is missing, please install.')
+ if json is None:
+ parser.error('json or simplejson library is missing, please install.')
api_url = '%s/api/%d' % (options.rietveld_url, options.issue)
logging.debug(api_url)
- contents = simplejson.loads(urllib.urlopen(api_url).read())
+ contents = json.loads(urllib.urlopen(api_url).read())
options.patchset = contents['patchsets'][-1]
diff_url = ('%s/download/issue%d_%d.diff' %
(options.rietveld_url, options.issue, options.patchset))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698