commit 6aa7e2b2eda363134b572306474e7d646d747315 Author: Cecylia Bocovich cohosh@torproject.org 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):