summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJF Bastien <jfb@chromium.org>2016-01-13 13:59:28 -0800
committerJF Bastien <jfb@chromium.org>2016-01-13 13:59:28 -0800
commit9a3a2cb975ab171c4f23c5bf5e938db940c707d4 (patch)
tree6450dcaae1a7ef879aea8ad9e1cd2aba2e66c42d
parent80d0b8eb31b1bb15ecd2245ef6ad57ca4d3a2575 (diff)
downloadbinaryen-9a3a2cb975ab171c4f23c5bf5e938db940c707d4.tar.gz
binaryen-9a3a2cb975ab171c4f23c5bf5e938db940c707d4.tar.bz2
binaryen-9a3a2cb975ab171c4f23c5bf5e938db940c707d4.zip
update.py: support json output
I'm updating the waterfall separately.
-rwxr-xr-xupdate.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/update.py b/update.py
index 99c142d79..dc30e6cae 100755
--- a/update.py
+++ b/update.py
@@ -16,6 +16,7 @@
import filecmp
import glob
+import json
import os
import shutil
import subprocess
@@ -33,7 +34,15 @@ TORTURE_DIR = os.path.join(BASE_DIR, 'torture-s')
def download_revision(force_latest):
name = 'latest' if force_latest else 'lkgr'
- return urllib2.urlopen(STORAGE_BASE + name).read().strip()
+ downloaded = urllib2.urlopen(STORAGE_BASE + name).read().strip()
+ # TODO: for now try opening as JSON, if that doesn't work then the content is
+ # just a hash. The waterfall is in the process of migrating to JSON.
+ info = None
+ try:
+ info = json.loads(downloaded)
+ except:
+ pass
+ return info['build'] if type(info) == dict else downloaded
def write_revision(revision):