Commit 016aacab authored by André Anjos's avatar André Anjos 💬

Merge branch 'update-miniconda-installer' into 'master'

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

See merge request !120
parents 1aead3e9 5d5b7c7f
Pipeline #34483 passed with stages
in 6 minutes and 26 seconds
......@@ -45,48 +45,63 @@ import logging
logger = logging.getLogger(__name__)
def do_hack(project_dir):
"""
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
and https://github.com/conda/conda-build/issues/3767)
"""
#### HACK to avoid ripgrep ignoring bin/ directories in our checkouts
import shutil
git_ignore_file = os.path.join(project_dir, '.gitignore')
import shutil
git_ignore_file = os.path.join(project_dir, ".gitignore")
if os.path.exists(git_ignore_file):
logger.warn('Removing ".gitignore" to overcome issues with ripgrep')
logger.warn('See https://gitlab.idiap.ch/bob/bob.devtools/merge_requests/112')
logger.warning('Removing ".gitignore" to overcome issues with ripgrep')
logger.warning(
"See https://gitlab.idiap.ch/bob/bob.devtools/merge_requests/112"
)
os.unlink(git_ignore_file)
#### END OF HACK
#### 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):
license_file = os.path.join(project_dir, 'LICENSE.AGPL')
recipe_dir = os.path.join(project_dir, 'conda')
license_file = os.path.join(project_dir, "LICENSE.AGPL")
recipe_dir = os.path.join(project_dir, "conda")
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.warn('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) ))
logger.warning(
"Copying LICENSE file to `./conda` dir to avoid issue with conda build (https://github.com/conda/conda-build/issues/3767)"
)
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
copying_file = os.path.join(project_dir, 'COPYING')
if(os.path.exists(copying_file)):
shutil.copyfile(copying_file, os.path.join(recipe_dir,"COPYING"))
meta_file = os.path.join(recipe_dir,"meta.yaml")
copying_file = os.path.join(project_dir, "COPYING")
if os.path.exists(copying_file):
shutil.copyfile(copying_file, os.path.join(recipe_dir, "COPYING"))
meta_file = os.path.join(recipe_dir, "meta.yaml")
recipe = open(meta_file).readlines()
recipe = [l.replace("../COPYING","COPYING").replace("../LICENSE","LICENSE").replace("../LICENSE.AGPL","LICENSE.AGPL") for l in recipe]
open(meta_file, "wt").write(''.join(recipe))
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
def set_environment(name, value, env=os.environ):
"""Function to setup the environment variable and print debug message.
......@@ -252,24 +267,27 @@ def ensure_miniconda_sh():
server = "repo.continuum.io" # https
# 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":
md5sum = 'b9974b2ef1b17b8be9b1fd2c619c6702'
md5sum = "677f38d5ab7e1ce4fef134068e3bd76a"
path = path % "MacOSX"
else:
md5sum = '1c945f2b3335c7b2b15130b1b2dc5cf4'
md5sum = "0dba759b8ecfc8948f626fa18785e3d8"
path = path % "Linux"
if os.path.exists("miniconda.sh"):
logger.info("(check) miniconda.sh md5sum (== %s?)", md5sum)
import hashlib
actual_md5 = hashlib.md5(open("miniconda.sh", "rb").read()).hexdigest()
if actual_md5 == md5sum:
logger.info("Re-using cached miniconda3 installer (hash matches)")
return
else:
logger.info("Erasing cached miniconda3 installer (%s does NOT " \
"match)", actual_md5)
logger.info(
"Erasing cached miniconda3 installer (%s does NOT " "match)",
actual_md5,
)
os.unlink("miniconda.sh")
# re-downloads installer
......@@ -489,10 +507,12 @@ if __name__ == "__main__":
# 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
# context. The URL should NOT work outside of Idiap's network.
f.write(_BASE_CONDARC.replace(
'https://repo.anaconda.com/pkgs/main',
'http://www.idiap.ch/defaults',
))
f.write(
_BASE_CONDARC.replace(
"https://repo.anaconda.com/pkgs/main",
"http://www.idiap.ch/defaults",
)
)
conda_version = "4"
conda_build_version = "3"
......
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