Commit dd47cc03 authored by André Anjos's avatar André Anjos 💬
Browse files

Merge branch 'miniconda-sh-hash-check' into 'master'

Check expected hash, redownloads if necessary

See merge request !97
parents 921ceac4 aac36dd3
Pipeline #32482 passed with stages
in 12 minutes and 52 seconds
......@@ -200,18 +200,40 @@ def merge_conda_cache(cache, prefix, name):
os.rename(cached_conda_bld, dst)
def get_miniconda_sh():
"""Retrieves the miniconda3 installer for the current system."""
def ensure_miniconda_sh():
"""Retrieves the miniconda3 installer for the current system.
import http.client
Checks the hash of the miniconda3 installer against the expected version,
if that does not match, erase existing installer and re-downloads new
server = "" # https
# WARNING: if you update this version, remember to update hahes below
path = "/miniconda/"
if platform.system() == "Darwin":
md5sum = 'ffa5f0eead5576fb26b7e6902f5eed09'
path = path % "MacOSX"
md5sum = '718259965f234088d785cad1fbd7de03'
path = path % "Linux"
if os.path.exists(""):"(check) md5sum (== %s?)", md5sum)
import hashlib
actual_md5 = hashlib.md5(open("", "rb").read()).hexdigest()
if actual_md5 == md5sum:"Re-using cached miniconda3 installer (hash matches)")
else:"Erasing cached miniconda3 installer (%s NOT match)",
# re-downloads installer
import http.client"Connecting to https://%s...", server)
conn = http.client.HTTPSConnection(server)
conn.request("GET", path)
......@@ -238,11 +260,7 @@ def install_miniconda(prefix, name):
""""Installing miniconda in %s...", prefix)
if not os.path.exists(""): # re-downloads installer
else:"Re-using cached miniconda3 installer")
cached = None
if os.path.exists(prefix): # this is the previous cache, move it
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment