From 19597ff45ec77d4d98537555316143b962dfd1f7 Mon Sep 17 00:00:00 2001 From: Phil Elson Date: Sat, 26 Mar 2016 22:26:21 +0000 Subject: [PATCH] Improved the use of whitespace in templates. --- conda_smithy/templates/run_docker_build.tmpl | 24 +++++++------ .../templates/run_docker_build_matrix.tmpl | 34 +++++++++---------- conda_smithy/templates/travis.yml.tmpl | 7 ++-- 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/conda_smithy/templates/run_docker_build.tmpl b/conda_smithy/templates/run_docker_build.tmpl index e288b173e..67974ae03 100644 --- a/conda_smithy/templates/run_docker_build.tmpl +++ b/conda_smithy/templates/run_docker_build.tmpl @@ -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 }} @@ -10,7 +13,7 @@ docker info config=$(cat < ~/.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 diff --git a/conda_smithy/templates/run_docker_build_matrix.tmpl b/conda_smithy/templates/run_docker_build_matrix.tmpl index 3d941e501..de5f96fc4 100644 --- a/conda_smithy/templates/run_docker_build_matrix.tmpl +++ b/conda_smithy/templates/run_docker_build_matrix.tmpl @@ -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 -%} diff --git a/conda_smithy/templates/travis.yml.tmpl b/conda_smithy/templates/travis.yml.tmpl index ba95c1292..b43a85039 100644 --- a/conda_smithy/templates/travis.yml.tmpl +++ b/conda_smithy/templates/travis.yml.tmpl @@ -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. @@ -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 %}