Skip to content

Commit

Permalink
Merge pull request #86 from pelson/better_matrix_determination
Browse files Browse the repository at this point in the history
Take into account the platform when determining the build matrix.
  • Loading branch information
pelson committed Mar 22, 2016
2 parents 937031f + d1f94cd commit 858d9ee
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 5 deletions.
45 changes: 41 additions & 4 deletions conda_smithy/configure_feedstock.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import print_function

from contextlib import contextmanager
import os
import shutil
import stat
Expand All @@ -8,6 +9,7 @@

import conda.api
from conda.resolve import MatchSpec
import conda_build.metadata
from conda_build.metadata import MetaData
from conda_build_all.version_matrix import special_case_version_matrix, filter_cases
from jinja2 import Environment, FileSystemLoader
Expand All @@ -17,6 +19,15 @@


def render_run_docker_build(jinja_env, forge_config, forge_dir):
with fudge_subdir('linux-64'):
meta = forge_config['package']
meta.parse_again()
matrix = compute_build_matrix(meta)

if matrix:
forge_config = forge_config.copy()
forge_config['matrix'] = matrix

# TODO: Conda has a convenience for accessing nested yaml content.
template_name = forge_config.get('templates', {}).get('run_docker_build',
'run_docker_build_matrix.tmpl')
Expand All @@ -28,7 +39,24 @@ def render_run_docker_build(jinja_env, forge_config, forge_dir):
os.chmod(run_docker_build_fname, st.st_mode | stat.S_IEXEC)


@contextmanager
def fudge_subdir(subdir):
orig = conda_build.metadata.cc.subdir
conda_build.metadata.cc.subdir = subdir
yield
conda_build.metadata.cc.subdir = orig


def render_travis(jinja_env, forge_config, forge_dir):
with fudge_subdir('osx-64'):
meta = forge_config['package']
meta.parse_again()
matrix = compute_build_matrix(meta)

if matrix:
forge_config = forge_config.copy()
forge_config['matrix'] = matrix

template = jinja_env.get_template('travis.yml.tmpl')
target_fname = os.path.join(forge_dir, '.travis.yml')
with open(target_fname, 'w') as fh:
Expand All @@ -43,6 +71,19 @@ def render_README(jinja_env, forge_config, forge_dir):


def render_appveyor(jinja_env, forge_config, forge_dir):
with fudge_subdir('win-64'):
meta = forge_config['package']
meta.parse_again()
matrix = compute_build_matrix(meta)

if matrix:
forge_config = forge_config.copy()
forge_config['matrix'] = matrix

# TODO: Remove the appveyor result if it is Win skip.
# Note: This should look at all of the matrix items, and only
# skip if *all* of them skip. We definitely want to unit test that.

template = jinja_env.get_template('appveyor.yml.tmpl')
target_fname = os.path.join(forge_dir, 'appveyor.yml')
with open(target_fname, 'w') as fh:
Expand Down Expand Up @@ -110,10 +151,6 @@ def main(forge_file_directory):

config['package'] = meta = meta_of_feedstock(forge_file_directory)

matrix = compute_build_matrix(meta)
if matrix:
config['matrix'] = matrix

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'),
Expand Down
2 changes: 1 addition & 1 deletion conda_smithy/templates/travis.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ env:
install:
- |
MINICONDA_URL="http://repo.continuum.io/miniconda"
MINICONDA_FILE="Miniconda3-3.7.3-MacOSX-x86_64.sh"
MINICONDA_FILE="Miniconda3-latest-MacOSX-x86_64.sh"
wget "${MINICONDA_URL}/${MINICONDA_FILE}"
bash $MINICONDA_FILE -b

Expand Down

0 comments on commit 858d9ee

Please sign in to comment.