Commit 57af1710 authored by maruel@chromium.org's avatar maruel@chromium.org

Fix support with python 2.6 without simplejson.

Review URL: http://codereview.chromium.org/1050005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@41902 0039d316-1c4b-4281-b951-d872f2087c98
parent dc06a868
......@@ -20,6 +20,14 @@ import sys
import tempfile
import urllib
try:
import simplejson as json
except ImportError:
try:
import json
except ImportError:
json = None
try:
import breakpad
except ImportError:
......@@ -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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment