Add use existing branch confirmation and progress for file download (#6294)
* Add `use existing branch for release` confirmation. Otherwise, this message might go unnoticed and we might build the wrong binaries * Display the progress of downloaded artifacts so we can be sure the process is working
This commit is contained in:
parent
24dbf7333d
commit
326aacf353
2 changed files with 17 additions and 4 deletions
|
|
@ -142,9 +142,14 @@ if not args.simulate:
|
|||
# open file to write in binary mode
|
||||
with open(target, "wb") as file:
|
||||
# get request
|
||||
response = requests.get(url, headers=headers)
|
||||
# write to file
|
||||
file.write(response.content)
|
||||
with requests.get(url, headers=headers, stream=True) as response:
|
||||
total = int(response.headers.get('Content-Length', 0))
|
||||
totalStr = "{0:.2f}".format(total / 1024 / 1024)
|
||||
for chunk in response.iter_content(chunk_size=65536):
|
||||
if chunk: # filter out keep-alive new chunks
|
||||
file.write(chunk)
|
||||
current = "{0:.2f}".format(file.tell() / 1024 / 1024)
|
||||
print(f"Downloaded {current}/{totalStr} MB", end="\r")
|
||||
print("Verifying file size...")
|
||||
# get the file size
|
||||
size = os.path.getsize(target)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue