BLD: Only upload to anaconda if on master

This commit is contained in:
Richard Frank
2016-03-23 15:26:55 -04:00
parent 6d66fb46ef
commit 70cbee0468
2 changed files with 13 additions and 10 deletions
+3 -2
View File
@@ -46,20 +46,21 @@ script:
- flake8 zipline tests
# deactive env to get access to anaconda command
- source deactivate
- if [[ "$TRAVIS_SECURE_ENV_VARS" = "true" && "$TRAVIS_BRANCH" = "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]; then DO_UPLOAD="true"; else DO_UPLOAD="false"; fi
- |
for recipe in $(ls -d conda/*/ | xargs -I {} basename {}); do
if [[ "$recipe" = "zipline" ]]; then continue; fi
conda build conda/$recipe --python=$CONDA_PY --numpy=$CONDA_NPY --skip-existing -c quantopian -c https://conda.anaconda.org/quantopian/label/ci
RECIPE_OUTPUT=$(conda build conda/$recipe --python=$CONDA_PY --numpy=$CONDA_NPY --output)
if [[ -f "$RECIPE_OUTPUT" && "$TRAVIS_SECURE_ENV_VARS" = "true" ]]; then anaconda -t $ANACONDA_TOKEN upload "$RECIPE_OUTPUT" -u quantopian --label ci; fi
if [[ -f "$RECIPE_OUTPUT" && "$DO_UPLOAD" = "true" ]]; then anaconda -t $ANACONDA_TOKEN upload "$RECIPE_OUTPUT" -u quantopian --label ci; fi
done
# unshallow the clone so the conda build can clone it.
- git fetch --unshallow
- exec 3>&1; ZP_OUT=$(conda build conda/zipline --python=$CONDA_PY --numpy=$CONDA_NPY -c quantopian -c https://conda.anaconda.org/quantopian/label/ci | tee >(cat - >&3))
- ZP_OUTPUT=$(echo "$ZP_OUT" | grep "anaconda upload" | awk '{print $NF}')
- if [[ "$TRAVIS_SECURE_ENV_VARS" = "true" ]]; then anaconda -t $ANACONDA_TOKEN upload $ZP_OUTPUT -u quantopian --label ci; fi
- if [[ "$DO_UPLOAD" = "true" ]]; then anaconda -t $ANACONDA_TOKEN upload $ZP_OUTPUT -u quantopian --label ci; fi
# reactivate env (necessary for coveralls)
- source activate testenv
+10 -8
View File
@@ -25,11 +25,11 @@ def iter_stdout(cmd):
PKG_PATH_PATTERN = re.compile(".* anaconda upload (?P<pkg_path>.+)$")
def main():
def main(env, do_upload):
for recipe in get_immediate_subdirectories('conda'):
cmd = ["conda", "build", os.path.join('conda', recipe),
"--python", os.environ['CONDA_PY'],
"--numpy", os.environ['CONDA_NPY'],
"--python", env['CONDA_PY'],
"--numpy", env['CONDA_NPY'],
"--skip-existing",
"-c", "quantopian",
"-c", "https://conda.anaconda.org/quantopian/label/ci"]
@@ -44,10 +44,8 @@ def main():
if match:
output = match.group('pkg_path')
if (output and os.path.exists(output) and
os.environ.get('ANACONDA_TOKEN')):
cmd = ["anaconda", "-t", os.environ['ANACONDA_TOKEN'],
if output and os.path.exists(output) and do_upload:
cmd = ["anaconda", "-t", env['ANACONDA_TOKEN'],
"upload", output, "-u", "quantopian", "--label", "ci"]
for line in iter_stdout(cmd):
@@ -55,4 +53,8 @@ def main():
if __name__ == '__main__':
main()
env = os.environ.copy()
main(env,
do_upload=(env.get('ANACONDA_TOKEN') and
env.get('APPVEYOR_REPO_BRANCH') == 'master') and
'APPVEYOR_PULL_REQUEST_NUMBER' not in env)