mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Don't open file twice when downloading conda
Unnecessary, and could also possibly cause races - see https://github.com/jupyterhub/the-littlest-jupyterhub/pull/710#issuecomment-946165463
This commit is contained in:
@@ -49,9 +49,8 @@ def download_miniconda_installer(installer_url, sha256sum):
|
|||||||
of given version, verifies the sha256sum & provides path to it to the `with`
|
of given version, verifies the sha256sum & provides path to it to the `with`
|
||||||
block to run.
|
block to run.
|
||||||
"""
|
"""
|
||||||
with tempfile.NamedTemporaryFile() as f:
|
with tempfile.NamedTemporaryFile('wb') as f:
|
||||||
with open(f.name, 'wb') as f:
|
f.write(requests.get(installer_url).content)
|
||||||
f.write(requests.get(installer_url).content)
|
|
||||||
|
|
||||||
if sha256_file(f.name) != sha256sum:
|
if sha256_file(f.name) != sha256sum:
|
||||||
raise Exception('sha256sum hash mismatch! Downloaded file corrupted')
|
raise Exception('sha256sum hash mismatch! Downloaded file corrupted')
|
||||||
|
|||||||
Reference in New Issue
Block a user