For this to work you'll need to have the travis CLI installed and have already run login.


In [ ]:
import os
import subprocess
from functools import partial
from utils import appveyor_op, apply_to_all_projects, replace_str

working_dir = '/Users/jab08/_bump_condaci'

new_av_enc_key = 'tsajM8eklrwmWI6OdAEKi3FMqIUXUCHS45rPJZ3bwO25PRWi5onvLdsNMk+8vYRS'
old_av_env_key = 'mw1Fz5a5C0lT4CXzsOCADoo/Xa9YymZI3yjVZNR8f5GwYrVAOC2YXxyEG6NaSWZY'

new_key_secure = 'NOT_A_CHANCE'

replace_key = partial(replace_str, old_av_env_key, new_av_enc_key)
appveyor_key_replace = partial(appveyor_op, replace_key)


def bump_repo(repo_dir, restart_travis=True):
    os.chdir(repo_dir)
    if appveyor_key_replace(repo_dir):
        print('bumped {}'.format(repo_dir))
        print(subprocess.check_output(['git', 'commit', '-am', 'bump appveyor anaconda key']))
        print(subprocess.check_output(['git', 'push', 'origin', 'master']))
    print(subprocess.check_output(['travis', 'env', 'set', 'BINSTAR_KEY', new_key_secure]))
    if restart_travis:
        print(subprocess.check_output(['travis', 'restart']))

In [ ]:
apply_to_all_projects(working_dir, bump_repo)