Skip to content
Snippets Groups Projects
Commit 0f56af89 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Merge branch 'issue-26' into 'master'

Add option to --use-local in build/test

Closes #26

See merge request !44
parents 60df03b9 93537528
No related branches found
No related tags found
1 merge request!44Add option to --use-local in build/test
Pipeline #29407 passed
...@@ -67,6 +67,9 @@ Examples: ...@@ -67,6 +67,9 @@ Examples:
@click.option('-X', '--stable/--no-stable', default=False, @click.option('-X', '--stable/--no-stable', default=False,
help='Set this to **exclude** beta channels from your build - ' \ help='Set this to **exclude** beta channels from your build - ' \
'notice this option has no effect if you also pass --condarc') 'notice this option has no effect if you also pass --condarc')
@click.option('-L', '--use-local/--no-use-local', default=False,
help='Set this to **include** the locally built packages on the search ' \
'list - notice this option has no effect if you also pass --condarc')
@click.option('-d', '--dry-run/--no-dry-run', default=False, @click.option('-d', '--dry-run/--no-dry-run', default=False,
help='Only goes through the actions, but does not execute them ' \ help='Only goes through the actions, but does not execute them ' \
'(combine with the verbosity flags - e.g. ``-vvv``) to enable ' \ '(combine with the verbosity flags - e.g. ``-vvv``) to enable ' \
...@@ -76,7 +79,7 @@ Examples: ...@@ -76,7 +79,7 @@ Examples:
@verbosity_option() @verbosity_option()
@bdt.raise_on_error @bdt.raise_on_error
def build(recipe_dir, python, condarc, config, no_test, append_file, def build(recipe_dir, python, condarc, config, no_test, append_file,
server, group, private, stable, dry_run, ci): server, group, private, stable, use_local, dry_run, ci):
"""Builds package through conda-build with stock configuration """Builds package through conda-build with stock configuration
This command wraps the execution of conda-build so that you use the same This command wraps the execution of conda-build so that you use the same
...@@ -104,10 +107,12 @@ def build(recipe_dir, python, condarc, config, no_test, append_file, ...@@ -104,10 +107,12 @@ def build(recipe_dir, python, condarc, config, no_test, append_file,
condarc_options = yaml.load(f) condarc_options = yaml.load(f)
else: else:
# use default and add channels # use default and add channels
all_channels = ['local'] if use_local else []
all_channels += channels + ['defaults']
condarc_options = yaml.load(BASE_CONDARC) #n.b.: no channels condarc_options = yaml.load(BASE_CONDARC) #n.b.: no channels
logger.info('Using the following channels during build:\n - %s', logger.info('Using the following channels during build:\n - %s',
'\n - '.join(channels + ['defaults'])) '\n - '.join(all_channels))
condarc_options['channels'] = channels + ['defaults'] condarc_options['channels'] = all_channels
# dump packages at base environment # dump packages at base environment
prefix = get_env_directory(os.environ['CONDA_EXE'], 'base') prefix = get_env_directory(os.environ['CONDA_EXE'], 'base')
......
...@@ -280,9 +280,10 @@ def base_build(order, group, python, dry_run): ...@@ -280,9 +280,10 @@ def base_build(order, group, python, dry_run):
# use default and add channels # use default and add channels
condarc_options = yaml.load(BASE_CONDARC) #n.b.: no channels condarc_options = yaml.load(BASE_CONDARC) #n.b.: no channels
channels = ['local'] + channels + ['defaults']
logger.info('Using the following channels during build:\n - %s', logger.info('Using the following channels during build:\n - %s',
'\n - '.join(channels + ['defaults'])) '\n - '.join(channels))
condarc_options['channels'] = channels + ['defaults'] condarc_options['channels'] = channels
# dump packages at conda_root # dump packages at conda_root
condarc_options['croot'] = os.path.join(os.environ['CONDA_ROOT'], condarc_options['croot'] = os.path.join(os.environ['CONDA_ROOT'],
...@@ -356,6 +357,7 @@ def test(ctx, dry_run): ...@@ -356,6 +357,7 @@ def test(ctx, dry_run):
group=group, group=group,
private=(os.environ['CI_PROJECT_VISIBILITY'] != 'public'), private=(os.environ['CI_PROJECT_VISIBILITY'] != 'public'),
stable='CI_COMMIT_TAG' in os.environ, stable='CI_COMMIT_TAG' in os.environ,
use_local=False,
dry_run=dry_run, dry_run=dry_run,
ci=True, ci=True,
) )
...@@ -400,6 +402,7 @@ def build(ctx, dry_run): ...@@ -400,6 +402,7 @@ def build(ctx, dry_run):
group=group, group=group,
private=(os.environ['CI_PROJECT_VISIBILITY'] != 'public'), private=(os.environ['CI_PROJECT_VISIBILITY'] != 'public'),
stable='CI_COMMIT_TAG' in os.environ, stable='CI_COMMIT_TAG' in os.environ,
use_local=False,
dry_run=dry_run, dry_run=dry_run,
ci=True, ci=True,
) )
...@@ -520,6 +523,7 @@ def nightlies(ctx, order, dry_run): ...@@ -520,6 +523,7 @@ def nightlies(ctx, order, dry_run):
group=group, group=group,
private=private, private=private,
stable=stable, stable=stable,
use_local=True,
dry_run=dry_run, dry_run=dry_run,
ci=True, ci=True,
) )
......
...@@ -58,6 +58,9 @@ Examples: ...@@ -58,6 +58,9 @@ Examples:
@click.option('-X', '--stable/--no-stable', default=False, @click.option('-X', '--stable/--no-stable', default=False,
help='Set this to **exclude** beta channels from your build - ' \ help='Set this to **exclude** beta channels from your build - ' \
'notice this option has no effect if you also pass --condarc') 'notice this option has no effect if you also pass --condarc')
@click.option('-L', '--use-local/--no-use-local', default=False,
help='Set this to **include** the locally built packages on the search ' \
'list - notice this option has no effect if you also pass --condarc')
@click.option('-d', '--dry-run/--no-dry-run', default=False, @click.option('-d', '--dry-run/--no-dry-run', default=False,
help='Only goes through the actions, but does not execute them ' \ help='Only goes through the actions, but does not execute them ' \
'(combine with the verbosity flags - e.g. ``-vvv``) to enable ' \ '(combine with the verbosity flags - e.g. ``-vvv``) to enable ' \
...@@ -67,7 +70,7 @@ Examples: ...@@ -67,7 +70,7 @@ Examples:
@verbosity_option() @verbosity_option()
@bdt.raise_on_error @bdt.raise_on_error
def test(package, condarc, config, append_file, server, group, private, stable, def test(package, condarc, config, append_file, server, group, private, stable,
dry_run, ci): use_local, dry_run, ci):
"""Tests (pre-built) package through conda-build with stock configuration """Tests (pre-built) package through conda-build with stock configuration
This command wraps the execution of conda-build so that you use the same This command wraps the execution of conda-build so that you use the same
...@@ -93,10 +96,12 @@ def test(package, condarc, config, append_file, server, group, private, stable, ...@@ -93,10 +96,12 @@ def test(package, condarc, config, append_file, server, group, private, stable,
condarc_options = yaml.load(f) condarc_options = yaml.load(f)
else: else:
# use default and add channels # use default and add channels
all_channels = ['local'] if use_local else []
all_channels += channels + ['defaults']
condarc_options = yaml.load(BASE_CONDARC) #n.b.: no channels condarc_options = yaml.load(BASE_CONDARC) #n.b.: no channels
logger.info('Using the following channels during build:\n - %s', logger.info('Using the following channels during build:\n - %s',
'\n - '.join(channels + ['defaults'])) '\n - '.join(all_channels))
condarc_options['channels'] = channels + ['defaults'] condarc_options['channels'] = all_channels
conda_config = make_conda_config(config, None, append_file, conda_config = make_conda_config(config, None, append_file,
condarc_options) condarc_options)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment