Commit 8a864ab5 authored by Alex Cooper's avatar Alex Cooper Committed by Commit Bot

Fix update_bucket script for windows

Windows was not allowing copying of the temp file while it was still
open.  However, calling close by default causes the file to get deleted
automaticaly.  This defers that deletion.

Change-Id: I8ce712a4eb3de9d4d14f43389d341b016a64bae1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1539871Reviewed-by: default avatarKlaus Weidner <klausw@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644482}
parent a3724e37
......@@ -153,10 +153,14 @@ def write_index():
content = template.render({'items': items})
logging.debug('index.html content:\n%s', content)
with tempfile.NamedTemporaryFile(suffix='.html') as temp:
temp.write(content)
temp.seek(0)
run_modify('gsutil.py', 'cp', temp.name, BUCKET + '/index.html')
with tempfile.NamedTemporaryFile(suffix='.html', delete=False) as temp:
try:
temp.write(content)
temp.seek(0)
temp.close()
run_modify('gsutil.py', 'cp', temp.name, BUCKET + '/index.html')
finally:
os.unlink(temp.name)
def update_test_copies():
"""Uploads a new test copy if available"""
......
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