Skip to content
Snippets Groups Projects

Update miniconda installer to 4.7.12; Fix hashes to avoid...

Merged André Anjos requested to merge update-miniconda-installer into master
1 file
+ 53
33
Compare changes
  • Side-by-side
  • Inline
+ 53
33
@@ -45,48 +45,63 @@ import logging
@@ -45,48 +45,63 @@ import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger(__name__)
 
def do_hack(project_dir):
def do_hack(project_dir):
"""
"""
This function is supposed to be for temporary usage.
This function is supposed to be for temporary usage.
It implements hacks for the issues: https://gitlab.idiap.ch/bob/bob.devtools/merge_requests/112
It implements hacks for the issues: https://gitlab.idiap.ch/bob/bob.devtools/merge_requests/112
and https://github.com/conda/conda-build/issues/3767)
and https://github.com/conda/conda-build/issues/3767)
"""
"""
#### HACK to avoid ripgrep ignoring bin/ directories in our checkouts
#### HACK to avoid ripgrep ignoring bin/ directories in our checkouts
import shutil
import shutil
git_ignore_file = os.path.join(project_dir, '.gitignore')
 
git_ignore_file = os.path.join(project_dir, ".gitignore")
if os.path.exists(git_ignore_file):
if os.path.exists(git_ignore_file):
logger.warn('Removing ".gitignore" to overcome issues with ripgrep')
logger.warning('Removing ".gitignore" to overcome issues with ripgrep')
logger.warn('See https://gitlab.idiap.ch/bob/bob.devtools/merge_requests/112')
logger.warning(
 
"See https://gitlab.idiap.ch/bob/bob.devtools/merge_requests/112"
 
)
os.unlink(git_ignore_file)
os.unlink(git_ignore_file)
#### END OF HACK
#### END OF HACK
#### HACK that avoids this issue: https://github.com/conda/conda-build/issues/3767
#### HACK that avoids this issue: https://github.com/conda/conda-build/issues/3767
license_file = os.path.join(project_dir, 'LICENSE')
license_file = os.path.join(project_dir, "LICENSE")
if not os.path.exists(license_file):
if not os.path.exists(license_file):
license_file = os.path.join(project_dir, 'LICENSE.AGPL')
license_file = os.path.join(project_dir, "LICENSE.AGPL")
recipe_dir = os.path.join(project_dir, 'conda')
recipe_dir = os.path.join(project_dir, "conda")
if os.path.exists(license_file) and os.path.exists(recipe_dir):
if os.path.exists(license_file) and os.path.exists(recipe_dir):
logger.warn('Copying LICENSE file to `./conda` dir to avoid issue with conda build (https://github.com/conda/conda-build/issues/3767)')
logger.warning(
logger.warn('Replacing ../LICENSE to LICENSE (https://github.com/conda/conda-build/issues/3767)')
"Copying LICENSE file to `./conda` dir to avoid issue with conda build (https://github.com/conda/conda-build/issues/3767)"
shutil.copyfile(license_file, os.path.join(recipe_dir, os.path.basename(license_file) ))
)
logger.warning(
 
"Replacing ../LICENSE to LICENSE (https://github.com/conda/conda-build/issues/3767)"
 
)
 
shutil.copyfile(
 
license_file,
 
os.path.join(recipe_dir, os.path.basename(license_file)),
 
)
 
# Checking COPYING file just in case
# Checking COPYING file just in case
copying_file = os.path.join(project_dir, 'COPYING')
copying_file = os.path.join(project_dir, "COPYING")
if(os.path.exists(copying_file)):
if os.path.exists(copying_file):
shutil.copyfile(copying_file, os.path.join(recipe_dir,"COPYING"))
shutil.copyfile(copying_file, os.path.join(recipe_dir, "COPYING"))
meta_file = os.path.join(recipe_dir,"meta.yaml")
meta_file = os.path.join(recipe_dir, "meta.yaml")
recipe = open(meta_file).readlines()
recipe = open(meta_file).readlines()
recipe = [l.replace("../COPYING","COPYING").replace("../LICENSE","LICENSE").replace("../LICENSE.AGPL","LICENSE.AGPL") for l in recipe]
recipe = [
open(meta_file, "wt").write(''.join(recipe))
l.replace("../COPYING", "COPYING")
 
.replace("../LICENSE", "LICENSE")
 
.replace("../LICENSE.AGPL", "LICENSE.AGPL")
 
for l in recipe
 
]
 
open(meta_file, "wt").write("".join(recipe))
#### END OF HACK
#### END OF HACK
def set_environment(name, value, env=os.environ):
def set_environment(name, value, env=os.environ):
"""Function to setup the environment variable and print debug message.
"""Function to setup the environment variable and print debug message.
@@ -252,24 +267,27 @@ def ensure_miniconda_sh():
@@ -252,24 +267,27 @@ def ensure_miniconda_sh():
server = "repo.continuum.io" # https
server = "repo.continuum.io" # https
# WARNING: if you update this version, remember to update hahes below
# WARNING: if you update this version, remember to update hahes below
path = "/miniconda/Miniconda3-4.7.10-%s-x86_64.sh"
path = "/miniconda/Miniconda3-4.7.12-%s-x86_64.sh"
if platform.system() == "Darwin":
if platform.system() == "Darwin":
md5sum = 'b9974b2ef1b17b8be9b1fd2c619c6702'
md5sum = "677f38d5ab7e1ce4fef134068e3bd76a"
path = path % "MacOSX"
path = path % "MacOSX"
else:
else:
md5sum = '1c945f2b3335c7b2b15130b1b2dc5cf4'
md5sum = "0dba759b8ecfc8948f626fa18785e3d8"
path = path % "Linux"
path = path % "Linux"
if os.path.exists("miniconda.sh"):
if os.path.exists("miniconda.sh"):
logger.info("(check) miniconda.sh md5sum (== %s?)", md5sum)
logger.info("(check) miniconda.sh md5sum (== %s?)", md5sum)
import hashlib
import hashlib
 
actual_md5 = hashlib.md5(open("miniconda.sh", "rb").read()).hexdigest()
actual_md5 = hashlib.md5(open("miniconda.sh", "rb").read()).hexdigest()
if actual_md5 == md5sum:
if actual_md5 == md5sum:
logger.info("Re-using cached miniconda3 installer (hash matches)")
logger.info("Re-using cached miniconda3 installer (hash matches)")
return
return
else:
else:
logger.info("Erasing cached miniconda3 installer (%s does NOT " \
logger.info(
"match)", actual_md5)
"Erasing cached miniconda3 installer (%s does NOT " "match)",
 
actual_md5,
 
)
os.unlink("miniconda.sh")
os.unlink("miniconda.sh")
# re-downloads installer
# re-downloads installer
@@ -489,10 +507,12 @@ if __name__ == "__main__":
@@ -489,10 +507,12 @@ if __name__ == "__main__":
# http://www.idiap.ch/software/bob/defaults with so it is optimized for
# http://www.idiap.ch/software/bob/defaults with so it is optimized for
# a CI build. Notice we consider this script is only executed in this
# a CI build. Notice we consider this script is only executed in this
# context. The URL should NOT work outside of Idiap's network.
# context. The URL should NOT work outside of Idiap's network.
f.write(_BASE_CONDARC.replace(
f.write(
'https://repo.anaconda.com/pkgs/main',
_BASE_CONDARC.replace(
'http://www.idiap.ch/defaults',
"https://repo.anaconda.com/pkgs/main",
))
"http://www.idiap.ch/defaults",
 
)
 
)
conda_version = "4"
conda_version = "4"
conda_build_version = "3"
conda_build_version = "3"
Loading