Ejemplo n.º 1
0
def release(component='patch', target='local'):
    """ Release new version of the project.

    This will bump the version number (patch component by default), add
    and tag a commit with that change and upload new version ty pypi.
    """
    with quiet():
        git_status = local('git status --porcelain', capture=True).strip()
        has_changes = len(git_status) > 0

    if has_changes:
        sysmsg("Cannot release: there are uncommitted changes")
        exit(1)

    infomsg("Bumping package version")
    old_ver, new_ver = bump_version_file('VERSION', component)
    infomsg("  old version: \033[35m{}".format(old_ver))
    infomsg("  new version: \033[35m{}".format(new_ver))

    infomsg("Creating commit that marks the release")
    with quiet():
        local(
            'git add VERSION && git commit -m "Release: v{}"'.format(new_ver))
        local('git tag -a "{ver}" -m "Mark {ver} release"'.format(ver=new_ver))

    infomsg("Uploading to pypi server \033[33m{}".format(target))
    with quiet():
        local('python setup.py sdist register -r "{}"'.format(target))
        local('python setup.py sdist upload -r "{}"'.format(target))
Ejemplo n.º 2
0
def bump(component='patch'):
    """ Bump the given version component (major/minor/patch/build) """
    sysmsg("Bumping package version")

    old_ver, new_ver = bump_version_file('VERSION', component)

    infomsg("  old version: \033[35m{}".format(old_ver))
    infomsg("  new version: \033[35m{}".format(new_ver))
Ejemplo n.º 3
0
def test(quick=False, junit=False):
    """ Run tests against the current python version. """
    sysmsg("Running tests against the current python version")

    args = ['test/unit']

    if not quick:
        args += [
            '--cov=src/jsobj',
            '--cov-report=term:skip-covered',
            '--cov-report=html:{}/coverage'.format(DIST_DIR),
        ]

    if junit:
        args += [
            '--junitxml={}/test-results.xml'.format(DIST_DIR),
        ]

    infomsg("Running with:\n{}".format("\n".join(args)))
    local('pytest {}'.format(' '.join(args)))
Ejemplo n.º 4
0
def upload(target='local'):
    """ Release to a given pypi server ('local' by default). """
    sysmsg("Uploading to pypi server \033[33m{}".format(target))
    local('python setup.py sdist register -r "{}"'.format(target))
    local('python setup.py sdist upload -r "{}"'.format(target))
Ejemplo n.º 5
0
def testall():
    """ Run tests against all supported python versions. """
    sysmsg("Running tests against all supported python versions")
    local('tox')