Example #1
0
def test_deployable():
    """
    Check current version against last git tag and check for outstanding
    untracked files
    """
    pytest.dbgfunc()
    staged, changed, untracked = tbx.git_status()
    assert untracked == [], "You have untracked files"
    assert changed == [], "You have unstaged updates"
    assert staged == [], "You have updates staged but not committed"

    if tbx.git_current_branch() != 'master':
        return True

    last_tag = tbx.git_last_tag()
    msg = "Version ({}) does not match tag ({})".format(
        version.__version__(), last_tag)
    assert version.__version__ == last_tag, msg
    assert tbx.git_hash() == tbx.git_hash(last_tag), "Tag != HEAD"
Example #2
0
def test_deploy():
    """
    Check that 1) no untracked files are hanging out, 2) no staged but
    uncommitted updates are outstanding, 3) no unstaged, uncommitted changes
    are outstanding, 4) the most recent git tag matches HEAD, and 5) the most
    recent git tag matches the current version.
    """
    pytest.dbgfunc()
    staged, changed, untracked = tbx.git_status()
    assert untracked == [], "You have untracked files"
    assert changed == [], "You have unstaged updates"
    assert staged == [], "You have updates staged but not committed"

    if tbx.git_current_branch() != 'master':
        return True

    last_tag = tbx.git_last_tag()
    msg = "Version ({}) does not match tag ({})".format(version._v, last_tag)
    assert version._v == last_tag, msg
    assert tbx.git_hash() == tbx.git_hash(last_tag), "Tag != HEAD"
Example #3
0
def pyppi_cpush(**kw):
    """
    if mtime(root/*/index.html) < mtime(FILENAME):
        build
    if any non pypi files staged,
        complain and die
    if none of root/*/index.html pending:
        complain and die
    git add root/*/index.html
    git commit -m MESSAGE
    git push
    """
    conditional_debug(kw['d'])
    filename = kw['FILENAME']
    cfg = read_cfg_file(filename)
    if index_out_of_date(filename, cfg):
        shutil.rmtree(cfg['root'])
        build_dirs(cfg)
        build_index_htmls(cfg)

    root = cfg['root']
    (untracked, unstaged, uncommitted) = tbx.git_status()
    others = [_ for _ in uncommitted if root not in _ or 'index.html' not in _]
    if others:
        sys.exit("You have files staged. Please commit them and try again.")

    taddables = [_ for _ in untracked if root in _ and 'index.html' in _]
    saddables = [_ for _ in unstaged if root in _ and 'index.html' in _]
    addables = taddables + saddables
    if len(addables) == 0:
        sys.exit("No pypi index.html files are unstaged")
    else:
        git_add(addables)

    git_commit(message=kw['m'])
    git_push()