Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions conda_smithy/configure_feedstock.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,7 @@ def render_circle(jinja_env, forge_config, forge_dir):
forge_config['upload_script'] = "upload_or_check_non_existence"

# TODO: Conda has a convenience for accessing nested yaml content.
templates = forge_config.get('templates', {})
template_name = templates.get('run_docker_build',
'run_docker_build_matrix.tmpl')
template_name = 'run_docker_build.tmpl'
template = jinja_env.get_template(template_name)
target_fname = os.path.join(forge_dir, 'ci_support', 'run_docker_build.sh')
with write_file(target_fname) as fh:
Expand Down Expand Up @@ -650,7 +648,7 @@ def main(forge_file_directory):
config = {'docker': {'executable': 'docker',
'image': 'condaforge/linux-anvil',
'command': 'bash'},
'templates': {'run_docker_build': 'run_docker_build_matrix.tmpl'},
'templates': {},
'travis': {},
'circle': {},
'appveyor': {},
Expand Down Expand Up @@ -702,7 +700,8 @@ def main(forge_file_directory):

tmplt_dir = os.path.join(conda_forge_content, 'templates')
# Load templates from the feedstock in preference to the smithy's templates.
env = Environment(loader=FileSystemLoader([os.path.join(forge_dir, 'templates'),
env = Environment(extensions=['jinja2.ext.do'],
loader=FileSystemLoader([os.path.join(forge_dir, 'templates'),
tmplt_dir]))

copy_feedstock_content(forge_dir)
Expand Down
29 changes: 27 additions & 2 deletions conda_smithy/templates/circle.yml.tmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{%- macro matrix_case_name(matrix_item) -%}
build
{%- for dep, ver in matrix_item -%}
__{{ dep }}_{{ ver }}
{%- endfor %}
{%- endmacro -%}

version: 2

jobs:
Expand All @@ -14,9 +21,16 @@ jobs:
# The Circle-CI build should not be active, but if this is not true for some reason, do a fast finish.
command: exit 0
{%- else %}
build:
{%- for case in matrix %}
{{ matrix_case_name(case) }}:
working_directory: ~/test
machine: true
{%- if case[0] %}
environment:
{%- for dep, ver in case %}
- {{ dep }}: "{{ ver }}"
{%- endfor -%}
{%- endif %}
steps:
- checkout
- run:
Expand All @@ -26,9 +40,18 @@ jobs:
./ci_support/checkout_merge_commit.sh
- run:
command: docker pull condaforge/linux-anvil
{%- if case[0] %}
- run:
name: Print conda-build environment variables
command: |
{%- for dep, ver in case %}
echo {{ '"' }}{{ dep }}{{ '=${' }}{{ dep }}{{ '}"' }}
{%- endfor -%}
{%- endif %}
- run:
# Run, test and (if we have a BINSTAR_TOKEN) upload the distributions.
command: ./ci_support/run_docker_build.sh
{%- endfor -%}
{%- endif -%}
{%- endblock %}

Expand All @@ -44,7 +67,9 @@ workflows:
ignore:
- /.*/
{%- else %}
- build
{%- for case in matrix %}
- {{ matrix_case_name(case) }}
{%- endfor -%}
{%- endif -%}
{%- endblock %}
{# #}
19 changes: 15 additions & 4 deletions conda_smithy/templates/run_docker_build.tmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
{%- macro matrix_env_vars(a_matrix) -%}
{{ '-e HOST_USER_ID="${HOST_USER_ID}" \\' }}
{%- set vars_used = [] %}
{%- for case in a_matrix -%}
{%- for dep, ver in case -%}
{%- if dep not in vars_used %}
-e {{ dep }}="${{ "{" }}{{ dep }}{{ "}" }}" \
{%- do vars_used.append(dep) -%}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would add this macro seems pretty slow. Really what we would want here is a way to get a Python set in Jinja, but did not see an obvious way to do that. If others have suggestions, would be interested to hear them.

{%- endif -%}
{%- endfor -%}
{%- endfor -%}
{%- endmacro -%}

#!/usr/bin/env bash

# PLEASE NOTE: This script has been automatically generated by conda-smithy. Any changes here
Expand Down Expand Up @@ -40,7 +53,7 @@ rm -f "$FEEDSTOCK_ROOT/build_artefacts/conda-forge-build-done"
cat << EOF | {{ docker.executable }} run -i \
-v "${RECIPE_ROOT}":/recipe_root \
-v "${FEEDSTOCK_ROOT}":/feedstock_root \
-e HOST_USER_ID="${HOST_USER_ID}" \
{{ matrix_env_vars(matrix) }}
-a stdin -a stdout -a stderr \
{{ docker.image }} \
{{ docker.command }} || exit 1
Expand All @@ -59,12 +72,10 @@ conda install --yes --quiet conda-forge-build-setup
{% if build_setup -%}
{{ build_setup }}{% endif -%}

{%- block build %}
conda build /recipe_root --quiet || exit 1
{%- for owner, channel in channels['targets'] %}
{{ upload_script }} /recipe_root {{ owner }} --channel={{ channel }} || exit 1
{%- endfor -%}
{%- endblock -%}
{%- endfor %}

touch /feedstock_root/build_artefacts/conda-forge-build-done
EOF
Expand Down
19 changes: 0 additions & 19 deletions conda_smithy/templates/run_docker_build_matrix.tmpl

This file was deleted.