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

Unified Diff: download_from_google_storage.py

Issue 696023002: Delete before cp in download_from_google_storage (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Review Created 6 years, 2 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: download_from_google_storage.py
diff --git a/download_from_google_storage.py b/download_from_google_storage.py
index 8370515e6a15879c3ddf5c1e8693efeb595a8ccd..ffdd4ee97893ee7fb6e25e3a9cdc3be01268f838 100755
--- a/download_from_google_storage.py
+++ b/download_from_google_storage.py
@@ -236,8 +236,13 @@ def _downloader_worker_thread(thread_num, q, force, base_url,
file_url, output_filename)))
continue
# Fetch the file.
- out_q.put('%d> Downloading %s...' % (
- thread_num, output_filename))
+ out_q.put('%d> Downloading %s...' % (thread_num, output_filename))
+ try:
+ os.remove(output_filename) # Delete the file if it exists already.
+ except OSError:
+ if os.path.exists(output_filename):
+ out_q.put('%d> Warning: deleting %s failed.' % (
+ thread_num, output_filename))
code, _, err = gsutil.check_call('cp', '-q', file_url, output_filename)
if code != 0:
out_q.put('%d> %s' % (thread_num, err))
« 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