diff --git a/.gitignore b/.gitignore index 424ce24065ecb84578be159006c3ccc7235dc081..458ed61ad5590e7a1e874eaf9c2065ea5032ea2b 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ build record.txt miniconda.sh miniconda/ +.DS_Store diff --git a/bob/devtools/ci.py b/bob/devtools/ci.py index 46b0200739e54a41e473eae40dec471fc1f46a85..5285730d34a5e9603c95896f5e24d752fe2c79bc 100644 --- a/bob/devtools/ci.py +++ b/bob/devtools/ci.py @@ -195,3 +195,13 @@ def select_conda_recipe_append(paths, branch): from .constants import CONDA_RECIPE_APPEND as default return select_build_file(default, paths, branch) or default + + +def select_user_condarc(paths, branch): + '''Selects the user condarc file to read (if any) + + See :py:func:`select_build_file` for implementation details. If no recipe + condarc is found by :py:func:`select_build_file`, then returns ``None``. + ''' + + return select_build_file('condarc', paths, branch) diff --git a/bob/devtools/scripts/ci.py b/bob/devtools/scripts/ci.py index 88dd09c799210e42aa3d7ea7765f41f78338fd4e..cdeb3c2a8dd156e8b8b8d37209323330a5fa83a8 100644 --- a/bob/devtools/scripts/ci.py +++ b/bob/devtools/scripts/ci.py @@ -14,7 +14,7 @@ from . import bdt from ..constants import SERVER, WEBDAV_PATHS, BASE_CONDARC from ..deploy import deploy_conda_package, deploy_documentation from ..ci import read_packages, comment_cleanup, uniq, \ - select_conda_build_config, select_conda_recipe_append + select_conda_build_config, select_conda_recipe_append, select_user_condarc from ..log import verbosity_option, get_logger, echo_normal logger = get_logger(__name__) @@ -278,7 +278,11 @@ def base_build(order, group, python, dry_run): this context. """ - condarc = os.path.join(os.environ['CONDA_ROOT'], 'condarc') + condarc = select_user_condarc(paths=[recipe, os.curdir], + branch=os.environ.get('CI_COMMIT_REF_NAME')) + + condarc = condarc or os.path.join(os.environ['CONDA_ROOT'], 'condarc') + if os.path.exists(condarc): logger.info('Loading (this build\'s) CONDARC file from %s...', condarc) with open(condarc, 'rb') as f: @@ -375,6 +379,11 @@ def test(ctx, dry_run): # Use custom variants and append files if available on recipe-dir recipe_dir = os.path.join(os.path.realpath(os.curdir), 'conda') + condarc = select_user_condarc(paths=[recipe, os.curdir], + branch=os.environ.get('CI_COMMIT_REF_NAME')) + if condarc is not None: + logger.info('Condarc configuration file: %s', condarc) + variants_file = select_conda_build_config(paths=[recipe_dir, os.curdir], branch=os.environ.get('CI_COMMIT_REF_NAME')) logger.info('Conda build configuration file: %s', variants_file) @@ -387,7 +396,7 @@ def test(ctx, dry_run): ctx.invoke(test, package = glob.glob(os.path.join(os.environ['CONDA_ROOT'], 'conda-bld', '*', os.environ['CI_PROJECT_NAME'] + '*.tar.bz2')), - condarc=None, #custom build configuration + condarc=condarc, config=variants_file, append_file=append_file, server=SERVER, @@ -429,6 +438,11 @@ def build(ctx, dry_run): # Use custom variants and append files if available on recipe-dir recipe_dir = os.path.join(os.path.realpath(os.curdir), 'conda') + condarc = select_user_condarc(paths=[recipe, os.curdir], + branch=os.environ.get('CI_COMMIT_REF_NAME')) + if condarc is not None: + logger.info('Condarc configuration file: %s', condarc) + variants_file = select_conda_build_config(paths=[recipe_dir, os.curdir], branch=os.environ.get('CI_COMMIT_REF_NAME')) logger.info('Conda build configuration file: %s', variants_file) @@ -441,7 +455,7 @@ def build(ctx, dry_run): ctx.invoke(build, recipe_dir=[recipe_dir], python=os.environ['PYTHON_VERSION'], #python version - condarc=None, #custom build configuration + condarc=condarc, config=variants_file, no_test=False, append_file=append_file, @@ -552,6 +566,11 @@ def nightlies(ctx, order, dry_run): # Use custom variants and append files if available on recipe-dir recipe_dir = os.path.join(clone_to, 'conda') + condarc = select_user_condarc(paths=[recipe, os.curdir], + branch=os.environ.get('CI_COMMIT_REF_NAME')) + if condarc is not None: + logger.info('Condarc configuration file: %s', condarc) + variants_file = select_conda_build_config(paths=[recipe_dir, os.curdir], branch=os.environ.get('CI_COMMIT_REF_NAME')) logger.info('Conda build configuration file: %s', variants_file) @@ -563,7 +582,7 @@ def nightlies(ctx, order, dry_run): ctx.invoke(build, recipe_dir=[recipe_dir], python=os.environ['PYTHON_VERSION'], #python version - condarc=None, #custom build configuration + condarc=condarc, config=variants_file, no_test=False, append_file=append_file,