

@task
def build_release():
    import os
    from subprocess import check_call, CalledProcessError
    from tempfile import mkdtemp, mkstemp
    release_clone = path(mkdtemp(prefix='paver-release-'))
    current_repo = path(os.curdir).abspath()
    branch = getattr(options, 'branch', 'master')
    try:
        branch.chdir()
        sh('git init')
        check_call(['git', 'remote', 'add', '-t', branch, '-f', 'origin', ('file://' + str(current_repo))])
        check_call(['git', 'checkout', '-b', branch, ('origin/%s' % branch)])
        sh('pip install -r release-requirements.txt')
        sh('paver html')
        sh('paver sdist upload')
        sh('paver bdist_wheel upload')
        sh('paver upload_sphinx --upload-dir=paver/docs')
    finally:
        release_clone.rmtree_p()

dataset/ETHPy150Open paver/paver/pavement.py build_release/VarMisuse@69/88 `release_clone`->`branch`