[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [gettor/master] Retry failed downloads
commit 6aa7e2b2eda363134b572306474e7d646d747315
Author: Cecylia Bocovich <cohosh@xxxxxxxxxxxxxx>
Date: Wed Dec 4 20:31:41 2019 -0500
Retry failed downloads
- also fixed a bug where releases won't be deleted untless the assets
are removed first
---
scripts/update_files | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/scripts/update_files b/scripts/update_files
index 827d7d5..8b705ae 100755
--- a/scripts/update_files
+++ b/scripts/update_files
@@ -1,5 +1,7 @@
#!/usr/bin/env python3
+#pip3 install PyGithub
+
from github import Github
import sys
@@ -11,8 +13,12 @@ REPO_NAME = "TheTorProject/gettorbrowser"
failure = False
+failed_uploads = []
+
def delete_old_releases(repo):
for release in repo.get_releases():
+ for asset in release.get_assets():
+ asset.delete_asset()
release.delete_release()
#Download list of tor browser releases and upload them to github
@@ -28,10 +34,17 @@ def upload_files(release):
subprocess.check_call(["/usr/bin/wget", "--quiet", url])
release.upload_asset(filename)
except:
- print("Error: failed to download "+url)
- print("Please upload this file manually.")
- failure = True
-
+ print("Error: failed to download "+url+". Will retry later.")
+ failed_uploads.append(url)
+ #Retry failed uploads
+ for url in failed_uploads:
+ filename = url.split('/')[-1]
+ try:
+ subprocess.check_call(["/usr/bin/wget", "--quiet", url])
+ release.upload_asset(filename)
+ except:
+ print("Error: failed to download "+url+". Please upload this file manually.")
+ failure = True
def main(token):
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits