Skip to content

Commit

Permalink
flush download output
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrauch committed Feb 16, 2024
1 parent fc92f46 commit 16de410
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@
"x64": "64"}

def download_check_fail(url, expected_type):
print("download URL:", url, flush=True)
response = requests.get(url, allow_redirects=True, timeout=60)
if not response.ok:
raise RuntimeError("error retrieving "+response.url)
if response.headers.get('content-type') != expected_type:
print("Warning: invalid content type, expected '{}', got '{}'".format(
expected_type, response.headers.get('content-type')))
expected_type, response.headers.get('content-type')), flush=True)
return response

def read_downloadable_archives(package):
Expand Down Expand Up @@ -86,8 +87,6 @@ def qtc_download_check_extract(cfg, dir_install):
for archive_name in archive_names:
url_archive = base_url+"/"+archive_name

print("download", url_archive)

content = download_check_fail(url_archive, "application/x-7z-compressed").content

if md5sums[archive_name] != hashlib.md5(content).hexdigest():
Expand Down Expand Up @@ -162,8 +161,6 @@ def qt_download_check_extract(cfg, dir_install):
for package_name, package_version, archive_name in archives_match:
url_archive = base_url+'/'+package_name+'/'+package_version+archive_name

print("download", url_archive)

content = download_check_fail(url_archive, "application/x-7z-compressed").content

sha1sum = download_check_fail(url_archive+".sha1", "application/x-7z-compressed").text
Expand Down

0 comments on commit 16de410

Please sign in to comment.