Skip to content

Commit

Permalink
Improved the use of whitespace in templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
pelson committed Mar 26, 2016
1 parent 7470c89 commit 19597ff
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 32 deletions.
24 changes: 13 additions & 11 deletions conda_smithy/templates/run_docker_build.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env bash

# NOTE: This script has been automatically generated by github.com/conda-forge/conda-smithy/...
# PLEASE NOTE: This script has been automatically generated by conda-smithy. Any changes here
# will be lost next time ``conda smithy rerender`` is run. If you would like to make permanent
# changes to this script, consider a proposal to conda-smithy so that other feedstocks can also
# benefit from the improvement.

FEEDSTOCK_ROOT=$(cd "$(dirname "$0")/.."; pwd;)
RECIPE_ROOT=$FEEDSTOCK_ROOT/{{ recipe_dir }}
Expand All @@ -10,7 +13,7 @@ docker info
config=$(cat <<CONDARC
channels:
{% for channel in channels.get('sources', []) | sort %}
{%- for channel in channels.get('sources', []) | sort %}
- {{ channel }}
{% endfor %}
- defaults # As we need conda-build
Expand Down Expand Up @@ -38,18 +41,17 @@ echo "$config" > ~/.condarc
conda clean --lock
conda update --yes --all
conda install --yes conda-build==1.18.2
conda info
{%if build_setup %}
{% if build_setup %}
{{ build_setup }}{% endif %}
{% block build -%}conda build /recipe_root --quiet || exit 1
{% for owner, channel in channels['targets'] %}
/feedstock_root/ci_support/upload_or_check_non_existence.py /recipe_root {{ owner }} --channel={{ channel }} || exit 1
{% endfor %}
{% endblock -%}
{% block build %}
conda build /recipe_root --quiet || exit 1
{%- for owner, channel in channels['targets'] %}
/feedstock_root/ci_support/upload_or_check_non_existence.py /recipe_root {{ owner }} --channel={{ channel }} || exit 1
{%- endfor %}
{%- endblock -%}
EOF

34 changes: 17 additions & 17 deletions conda_smithy/templates/run_docker_build_matrix.tmpl
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{% extends "run_docker_build.tmpl" %}

{% set conda_vars = {'python': 'CONDA_PY', 'numpy': 'CONDA_NPY'} %}

{%- extends "run_docker_build.tmpl" -%}
{%- set conda_vars = {'python': 'CONDA_PY', 'numpy': 'CONDA_NPY'} -%}
{% macro matrix_env(matrix_item) -%}
{% for dep_name, version in matrix_item | sort %}
{%- if dep_name in conda_vars %}{% set version = version|replace('.', '') %}{% endif %}
export {{ conda_vars.get(dep_name, 'CONDA_' + dep_name|upper) }}={{ version }}{% endfor %}
{%- endmacro %}
export {{ conda_vars.get(dep_name, 'CONDA_' + dep_name|upper) }}={{ version }}{% endfor %}
{%- endmacro -%}

{% block build -%}# Embarking on {{ matrix|length }} case(s).
{% for case in matrix | sort %}
set -x
{{- matrix_env(case) }}
set +x
{{ super()|indent }}
{%- block build -%}
# Embarking on {{ matrix|length }} case(s).
{%- for case in matrix | sort %}
{%- if case %}
set -x
{{- matrix_env(case) }}
set +x
{% endif -%}
{{ super() }}
{% endfor %}{% endblock -%}

{% block test_and_upload -%}{% for case in matrix | sort -%}
{{- matrix_env(case) }}
{{ super()|indent }}
{%- endfor %}{% endblock -%}
{%- block test_and_upload -%}{% for case in matrix | sort -%}
{{ matrix_env(case) }}
{{- super()|indent(2) }}
{%- endfor -%}{% endblock -%}
7 changes: 3 additions & 4 deletions conda_smithy/templates/travis.yml.tmpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{%- set conda_vars = {'python': 'CONDA_PY', 'numpy': 'CONDA_NPY'} -%}
{% macro matrix_env(matrix_item) -%}
{%- macro matrix_env(matrix_item) -%}
{% for dep_name, version in matrix_item | sort %}{%- if dep_name in conda_vars %}{% set version = version|replace('.', '') %}{% endif -%}
{{ conda_vars.get(dep_name, 'CONDA_' + dep_name|upper) }}={{ version }}{% if not loop.last %} {% endif %}{% endfor %}
{%- endmacro %}
{%- endmacro -%}
# This file was generated automatically from conda-smithy. To update this configuration,
# update the conda-forge.yaml and/or the recipe/meta.yaml.

Expand Down Expand Up @@ -38,8 +38,7 @@ install:

conda update --yes conda
conda install --yes conda-build jinja2 anaconda-client

{% for channel in channels.get('sources', []) %}
{%- for channel in channels.get('sources', []) %}
conda config --add channels {{ channel }}
{% endfor %}

Expand Down

0 comments on commit 19597ff

Please sign in to comment.