aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/skqp/download_model
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2018-01-30 16:08:17 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-30 21:40:40 +0000
commitce243ba1099127faf6367ae66e32b9e83c8ecc76 (patch)
treef09f31fdd8d327a62834fbe43517682c5cdf9ccc /tools/skqp/download_model
parent57b0430e19f3c8c2ebda4d8b705bc339af00e0fb (diff)
SkQP: fix upload/download scripts
Change-Id: If2b2ec786630e1ecea159e0804547a79478138f5 Reviewed-on: https://skia-review.googlesource.com/101844 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'tools/skqp/download_model')
-rwxr-xr-xtools/skqp/download_model11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/skqp/download_model b/tools/skqp/download_model
index de1aeeddc6..90a46256f6 100755
--- a/tools/skqp/download_model
+++ b/tools/skqp/download_model
@@ -9,6 +9,7 @@ import os
import shutil
import sys
import threading
+import tempfile
import urllib2
def checksum(path):
@@ -36,16 +37,22 @@ def download(md5, path):
with open(path, 'wb') as o:
shutil.copyfileobj(urllib2.urlopen(url), o)
+def tmp(prefix):
+ fd, path = tempfile.mkstemp(prefix=prefix)
+ os.close(fd)
+ return path
+
def main():
os.chdir(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
'platform_tools', 'android', 'apps', 'skqp', 'src',
'main', 'assets'))
sys.stderr.write('\n 0 / ???? ')
+ file_list_file = tmp('files_')
with open('files.checksum', 'r') as f:
md5 = f.read().strip()
assert(len(md5) == 32)
- download(md5, 'files.txt')
- with open('files.txt', 'r') as f:
+ download(md5, file_list_file)
+ with open(file_list_file, 'r') as f:
records = []
for line in f:
md5, path = line.strip().split(';', 1)