diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..288029d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +* text=auto + +meta.yaml text eol=lf +build.sh text eol=lf +bld.bat text eol=crlf diff --git a/.travis.yml b/.travis.yml index db22fdb..760a0c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,10 @@ # This file was generated automatically from conda-smithy. To update this configuration, -# update the conda-forge.yaml and/or the recipe/meta.yaml. +# update the conda-forge.yml and/or the recipe/meta.yaml. -language: objective-c +language: generic + +os: osx +osx_image: xcode6.4 env: global: @@ -10,29 +13,44 @@ env: before_install: + # Fast finish the PR. + - | + (curl https://raw.githubusercontent.com/conda-forge/conda-forge-build-setup-feedstock/master/recipe/ff_ci_pr_build.py | \ + python - -v --ci "travis" "${TRAVIS_REPO_SLUG}" "${TRAVIS_BUILD_NUMBER}" "${TRAVIS_PULL_REQUEST}") || exit 1 + # Remove homebrew. - - brew remove --force $(brew list) - - brew cleanup -s - - rm -rf $(brew --cache) + - | + echo "" + echo "Removing homebrew from Travis CI to avoid conflicts." + curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall > ~/uninstall_homebrew + chmod +x ~/uninstall_homebrew + ~/uninstall_homebrew -fq + rm ~/uninstall_homebrew + install: + # Install Miniconda. - | - MINICONDA_URL="http://repo.continuum.io/miniconda" + echo "" + echo "Installing a fresh version of Miniconda." + MINICONDA_URL="https://repo.continuum.io/miniconda" MINICONDA_FILE="Miniconda3-latest-MacOSX-x86_64.sh" - curl -O "${MINICONDA_URL}/${MINICONDA_FILE}" + curl -L -O "${MINICONDA_URL}/${MINICONDA_FILE}" bash $MINICONDA_FILE -b - export PATH=/Users/travis/miniconda3/bin:$PATH - - conda config --set show_channel_urls true - conda update --yes conda - conda install --yes conda-build=1.20.0 jinja2 anaconda-client + # Configure conda. + - | + echo "" + echo "Configuring conda." + source /Users/travis/miniconda3/bin/activate root + conda config --remove channels defaults + conda config --add channels defaults conda config --add channels conda-forge - + conda config --set show_channel_urls true + conda install --yes --quiet conda-forge-build-setup + source run_conda_forge_build_setup script: - conda build ./recipe -after_success: - - - ./ci_support/upload_or_check_non_existence.py ./recipe conda-forge --channel=main + - upload_or_check_non_existence ./recipe conda-forge --channel=main diff --git a/LICENSE b/LICENSE index 04ad21b..7f5c363 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ BSD 3-clause license -Copyright (c) conda-forge +Copyright (c) 2015-2017, conda-forge All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md index 9c0b3ec..310c79e 100644 --- a/README.md +++ b/README.md @@ -11,22 +11,34 @@ Summary: The Fast Library for Approximate Nearest Neighbors +Current build status +==================== + +Linux: [![Circle CI](https://circleci.com/gh/conda-forge/flann-feedstock.svg?style=shield)](https://circleci.com/gh/conda-forge/flann-feedstock) +OSX: [![TravisCI](https://travis-ci.org/conda-forge/flann-feedstock.svg?branch=master)](https://travis-ci.org/conda-forge/flann-feedstock) +Windows: ![](https://cdn.rawgit.com/conda-forge/conda-smithy/90845bba35bec53edac7a16638aa4d77217a3713/conda_smithy/static/disabled.svg) + +Current release info +==================== +Version: [![Anaconda-Server Badge](https://anaconda.org/conda-forge/flann/badges/version.svg)](https://anaconda.org/conda-forge/flann) +Downloads: [![Anaconda-Server Badge](https://anaconda.org/conda-forge/flann/badges/downloads.svg)](https://anaconda.org/conda-forge/flann) + Installing flann ================ -Installing flann from the conda-forge channel can be achieved by adding conda-forge to your channels with: +Installing `flann` from the `conda-forge` channel can be achieved by adding `conda-forge` to your channels with: ``` conda config --add channels conda-forge ``` -Once the conda-forge channel has been enabled, flann can be installed with: +Once the `conda-forge` channel has been enabled, `flann` can be installed with: ``` conda install flann ``` -It is possible to list all of the versions of flann available on your platform with: +It is possible to list all of the versions of `flann` available on your platform with: ``` conda search flann --channel conda-forge @@ -38,7 +50,7 @@ About conda-forge conda-forge is a community-led conda channel of installable packages. In order to provide high-quality builds, the process has been automated into the -conda-forge GitHub organization. The conda-forge organization contains one repository +conda-forge GitHub organization. The conda-forge organization contains one repository for each of the installable packages. Such a repository is known as a *feedstock*. A feedstock is made up of a conda recipe (the instructions on what and how to build @@ -51,8 +63,8 @@ packages to the [conda-forge](https://anaconda.org/conda-forge) To manage the continuous integration and simplify feedstock maintenance [conda-smithy](http://github.com/conda-forge/conda-smithy) has been developed. -Using the ``conda-forge.yml`` within this repository, it is possible to regenerate all of -this feedstock's supporting files (e.g. the CI configuration files) with ``conda smithy regenerate``. +Using the ``conda-forge.yml`` within this repository, it is possible to re-render all of +this feedstock's supporting files (e.g. the CI configuration files) with ``conda smithy rerender``. Terminology @@ -67,32 +79,25 @@ Terminology **conda-forge** - the place where the feedstock and smithy live and work to produce the finished article (built conda distributions) -Current build status -==================== - -Linux: [![Circle CI](https://circleci.com/gh/conda-forge/flann-feedstock.svg?style=svg)](https://circleci.com/gh/conda-forge/flann-feedstock) -OSX: [![TravisCI](https://travis-ci.org/conda-forge/flann-feedstock.svg?branch=master)](https://travis-ci.org/conda-forge/flann-feedstock) -Windows: [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/conda-forge/flann-feedstock?svg=True)](https://ci.appveyor.com/project/conda-forge/flann-feedstock/branch/master) - -Current release info -==================== -Version: [![Anaconda-Server Badge](https://anaconda.org/conda-forge/flann/badges/version.svg)](https://anaconda.org/conda-forge/flann) -Downloads: [![Anaconda-Server Badge](https://anaconda.org/conda-forge/flann/badges/downloads.svg)](https://anaconda.org/conda-forge/flann) - Updating flann-feedstock ======================== -If you would like to improve the flann recipe, please take the normal -route of forking this repository and submitting a PR. Upon submission, your changes will -be run on the appropriate platforms to give the reviewer an opportunity to confirm that the -changes result in a successful build. Once merged, the recipe will be re-built and uploaded -automatically to the conda-forge channel, whereupon they will be available for everybody to -install and use. +If you would like to improve the flann recipe or build a new +package version, please fork this repository and submit a PR. Upon submission, +your changes will be run on the appropriate platforms to give the reviewer an +opportunity to confirm that the changes result in a successful build. Once +merged, the recipe will be re-built and uploaded automatically to the +`conda-forge` channel, whereupon the built conda packages will be available for +everybody to install and use from the `conda-forge` channel. +Note that all branches in the conda-forge/flann-feedstock are +immediately built and any created packages are uploaded, so PRs should be based +on branches in forks and branches in the main repository should only be used to +build distinct package versions. In order to produce a uniquely identifiable distribution: * If the version of a package **is not** being increased, please add or increase - the [``build/number``](http://conda.pydata.org/docs/building/meta-yaml.html#build-number-and-string). + the [``build/number``](http://conda.pydata.org/docs/building/meta-yaml.html#build-number-and-string). * If the version of a package **is** being increased, please remember to return the [``build/number``](http://conda.pydata.org/docs/building/meta-yaml.html#build-number-and-string) back to 0. diff --git a/ci_support/checkout_merge_commit.sh b/ci_support/checkout_merge_commit.sh new file mode 100755 index 0000000..9528e4b --- /dev/null +++ b/ci_support/checkout_merge_commit.sh @@ -0,0 +1,27 @@ +#!/bin/bash + + +# Update PR refs for testing. +if [[ -n "${CIRCLE_PR_NUMBER}" ]] +then + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" +fi + +# Retrieve the refs. +if [[ -n "${CIRCLE_PR_NUMBER}" ]] +then + git fetch -u origin ${FETCH_REFS} +fi + +# Checkout the PR merge ref. +if [[ -n "${CIRCLE_PR_NUMBER}" ]] +then + git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" +fi + +# Check for merge conflicts. +if [[ -n "${CIRCLE_PR_NUMBER}" ]] +then + git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null +fi diff --git a/ci_support/fast_finish_ci_pr_build.sh b/ci_support/fast_finish_ci_pr_build.sh new file mode 100755 index 0000000..463c27f --- /dev/null +++ b/ci_support/fast_finish_ci_pr_build.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +curl https://raw.githubusercontent.com/conda-forge/conda-forge-build-setup-feedstock/master/recipe/ff_ci_pr_build.py | \ + python - -v --ci "circle" "${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" "${CIRCLE_BUILD_NUM}" "${CIRCLE_PR_NUMBER}" diff --git a/ci_support/run_docker_build.sh b/ci_support/run_docker_build.sh index 8c527c8..5c1bacb 100755 --- a/ci_support/run_docker_build.sh +++ b/ci_support/run_docker_build.sh @@ -14,8 +14,7 @@ config=$(cat < /dev/null && docker-machine active > /dev/null; then + HOST_USER_ID=$(docker-machine ssh $(docker-machine active) id -u) +fi + +rm -f "$FEEDSTOCK_ROOT/build_artefacts/conda-forge-build-done" + cat << EOF | docker run -i \ - -v ${RECIPE_ROOT}:/recipe_root \ - -v ${FEEDSTOCK_ROOT}:/feedstock_root \ + -v "${RECIPE_ROOT}":/recipe_root \ + -v "${FEEDSTOCK_ROOT}":/feedstock_root \ + -e HOST_USER_ID="${HOST_USER_ID}" \ -a stdin -a stdout -a stderr \ condaforge/linux-anvil \ - bash || exit $? + bash || exit 1 +set -e +set +x export BINSTAR_TOKEN=${BINSTAR_TOKEN} +set -x export PYTHONUNBUFFERED=1 echo "$config" > ~/.condarc # A lock sometimes occurs with incomplete builds. The lock file is stored in build_artefacts. conda clean --lock -conda update --yes --all -conda install --yes conda-build -conda info +conda install --yes --quiet conda-forge-build-setup +source run_conda_forge_build_setup # Embarking on 1 case(s). conda build /recipe_root --quiet || exit 1 - /feedstock_root/ci_support/upload_or_check_non_existence.py /recipe_root conda-forge --channel=main || exit 1 + upload_or_check_non_existence /recipe_root conda-forge --channel=main || exit 1 +touch /feedstock_root/build_artefacts/conda-forge-build-done EOF + +# double-check that the build got to the end +# see https://github.com/conda-forge/conda-smithy/pull/337 +# for a possible fix +set -x +test -f "$FEEDSTOCK_ROOT/build_artefacts/conda-forge-build-done" || exit 1 diff --git a/ci_support/upload_or_check_non_existence.py b/ci_support/upload_or_check_non_existence.py deleted file mode 100755 index 681f144..0000000 --- a/ci_support/upload_or_check_non_existence.py +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env python -from __future__ import print_function - -import argparse -import hashlib -import os -import subprocess -import sys - -from binstar_client.utils import get_binstar -import binstar_client.errors -import conda.config -from conda_build.metadata import MetaData -from conda_build.build import bldpkg_path - - -def built_distribution_already_exists(cli, meta, owner): - """ - Checks to see whether the built recipe (aka distribution) already - exists on the owner/user's binstar account. - - """ - distro_name = '{}/{}.tar.bz2'.format(conda.config.subdir, meta.dist()) - fname = bldpkg_path(meta) - try: - dist_info = cli.distribution(owner, meta.name(), meta.version(), - distro_name) - except binstar_client.errors.NotFound: - dist_info = {} - - exists = bool(dist_info) - # Unfortunately, we cannot check the md5 quality of the built distribution, as - # this will depend on fstat information such as modification date (because - # distributions are tar files). Therefore we can only assume that the distribution - # just built, and the one on anaconda.org are the same. -# if exists: -# md5_on_binstar = dist_info.get('md5') -# with open(fname, 'rb') as fh: -# md5_of_build = hashlib.md5(fh.read()).hexdigest() -# -# if md5_on_binstar != md5_of_build: -# raise ValueError('This build ({}), and the build already on binstar ' -# '({}) are different.'.format(md5_of_build, md5_on_binstar)) - return exists - - -def upload(cli, meta, owner, channels): - try: - with open('binstar.token', 'w') as fh: - fh.write(cli.token) - subprocess.check_call(['anaconda', '--quiet', '-t', 'binstar.token', - 'upload', bldpkg_path(meta), - '--user={}'.format(owner), - '--channel={}'.format(channels)], - env=os.environ) - finally: - os.remove('binstar.token') - - -def distribution_exists_on_channel(binstar_cli, meta, owner, channel='main'): - """ - Determine whether a distribution exists on a specific channel. - - Note from @pelson: As far as I can see, there is no easy way to do this on binstar. - - """ - fname = '{}/{}.tar.bz2'.format(conda.config.subdir, meta.dist()) - distributions_on_channel = [dist['basename'] for dist in - binstar_cli.show_channel(owner=owner, channel=channel)['files']] - return fname in distributions_on_channel - - -def add_distribution_to_channel(binstar_cli, meta, owner, channel='main'): - """ - Add a(n already existing) distribution on binstar to another channel. - - Note - the addition is done based on name and version - no build strings etc. - so if you have a foo-0.1-np18 and foo-0.1-np19 *both* will be added to the channel. - - """ - package_fname = '{}/{}.tar.bz2'.format(conda.config.subdir, meta.dist()) - binstar_cli.add_channel(channel, owner, meta.name(), meta.version()) - - -def main(): - token = os.environ.get('BINSTAR_TOKEN') - - description = ('Upload or check consistency of a built version of a ' - 'conda recipe with binstar. Note: The existence of the ' - 'BINSTAR_TOKEN environment variable determines ' - 'whether the upload should actually take place.') - parser = argparse.ArgumentParser(description=description) - parser.add_argument('recipe_dir', help='the conda recipe directory') - parser.add_argument('owner', help='the binstar owner/user') - parser.add_argument('--channel', help='the binstar channel', default='main') - args = parser.parse_args() - recipe_dir, owner, channel = args.recipe_dir, args.owner, args.channel - - cli = get_binstar(argparse.Namespace(token=token, site=None)) - meta = MetaData(recipe_dir) - if meta.skip(): - print("No upload to take place - this configuration was skipped in build/skip.") - return - exists = built_distribution_already_exists(cli, meta, owner) - if token: - on_channel = distribution_exists_on_channel(cli, meta, owner, channel) - if not exists: - upload(cli, meta, owner, channel) - print('Uploaded {}'.format(bldpkg_path(meta))) - elif not on_channel: - print('Adding distribution {} to {}\'s {} channel' - ''.format(bldpkg_path(meta), owner, channel)) - add_distribution_to_channel(cli, meta, owner, channel) - else: - print('Distribution {} already \nexists on {}\'s {} channel.' - ''.format(bldpkg_path(meta), owner, channel)) - else: - print("No BINSTAR_TOKEN present, so no upload is taking place. " - "The distribution just built {} already available on {}'s " - "{} channel.".format('is' if exists else 'is not', - owner, channel)) - -if __name__ == '__main__': - main() diff --git a/circle.yml b/circle.yml index 58649fa..421809c 100644 --- a/circle.yml +++ b/circle.yml @@ -1,3 +1,8 @@ +checkout: + post: + - ./ci_support/fast_finish_ci_pr_build.sh + - ./ci_support/checkout_merge_commit.sh + machine: services: - docker diff --git a/recipe/meta.yaml b/recipe/meta.yaml index cdf0c68..a4a4937 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -10,17 +10,17 @@ source: sha256: 59a9925dac0705b281496ae52b5dfd79d6b69316d37015e3d3b38c859bac4f2f build: - number: 0 + number: 1 skip: true # [win] requirements: build: - gcc # [unix] - - hdf5 1.8.17|1.8.17.* + - hdf5 1.8.18|1.8.18.* - cmake run: - libgcc # [unix] - - hdf5 1.8.17|1.8.17.* + - hdf5 1.8.18|1.8.18.* test: commands: