Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Hiro
GetTor
Commits
6aa7e2b2
Commit
6aa7e2b2
authored
Dec 04, 2019
by
Cecylia Bocovich
Browse files
Retry failed downloads
- also fixed a bug where releases won't be deleted untless the assets are removed first
parent
ee8d5a85
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/update_files
View file @
6aa7e2b2
#!/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
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment