Beispiel #1
0
def bump(cfg: Cfg):

    results = []

    if prmt.confirm("Do you want to BUMP VERSION number?", "n"):
        result = project.cmd.bump_version()
        cfg.version = result.val
        results.append(result)

    if prmt.confirm("Do you want to BUILD WHEEL?", "n"):
        results.append(build_wheel(cfg))

    if prmt.confirm("Do you want to PUSH WHEEL to PYPI?", "n"):
        results.append(push(cfg))

    new_release = cfg.version != proj["version"]

    return results
Beispiel #2
0
def bump(cfg: Cfg):
    results = []

    if prmt.confirm("BUMP VERSION number?", 'y'):
        result = project.cmd.bump_version()
        cfg.version = result.val
        results.append(result)

    if prmt.confirm("BUILD wheel?", 'y'):
        results.append(build(cfg))

    if prmt.confirm("PUSH wheel to PYPI?", 'y'):
        results.append(push(cfg))

    new_release = cfg.version != proj['version']

    results.extend(git.seq.bump_git(cfg.version, new_release))

    return results
Beispiel #3
0
def bump(cfg: Cfg):

    results = []

    if prmt.confirm("Do you want to BUMP VERSION number?", "n"):
        result = project.cmd.bump_version()
        cfg.version = result.val
        results.append(result)

    if prmt.confirm("Do you want to BUILD WHEEL?", "n"):
        results.append(build_wheel(cfg))

    if prmt.confirm("Do you want to PUSH WHEEL to PYPI?", "n"):
        results.append(push(cfg))

    if prmt.confirm("Do you want to BUILD DOCUMENTATION PAGES?", "n"):
        results.append(build_docs(cfg))

    new_release = cfg.version != proj['version']

    if prmt.confirm("Do you want to RUN GIT COMMANDS?", "n"):
        results.extend(git.seq.bump_git(cfg.version, new_release))

    return results
Beispiel #4
0
def build_docs(cfg: Cfg):

    q = (
        f"{fg.red}WARNING{fg.rs}\n"
        "Documentation changes and code changes should use seperate commits.\n"
        "Only proceed if there are no uncommited code changes.\n\n"
        "Do you want to build the documentation pages?"
    )
    if not prmt.confirm(q, 'n'):
        return

    # Build Static Page with Sphinx
    sp.run(['make', 'html'], cwd='sphinx')

    build_html_dir = 'sphinx/_build/html'

    if os.path.isfile(f"{build_html_dir}/index.html"):
        shutil.rmtree('docs', ignore_errors=True)
        shutil.copytree(build_html_dir, 'docs')
        shutil.rmtree(build_html_dir, ignore_errors=True)
        shutil.copyfile('sphinx/CNAME', 'docs/CNAME')

    # Remove modernizer
    # This is needed to reduce flickering on page load until this is fixed:
    # https://github.com/readthedocs/sphinx_rtd_theme/issues/724
    from glob import glob

    for html_file in glob("./docs/**/*.html", recursive=True):
        print(html_file)
        data = ""
        with open(html_file, 'r') as fr:
            for line in fr:
                if 'modernizr.min.js"' not in line and \
                   'js/theme.js' not in line:

                    data += line

        with open(html_file, 'w') as fw:
            fw.write(data)
Beispiel #5
0
def build_docs(cfg: Cfg):

    q = (
        f"{fg.red}WARNING{fg.rs}\n"
        "Documentation changes and code changes should use seperate commits.\n"
        "Only proceed if there are no uncommited code changes.\n\n"
        "Do you want to build the documentation pages?")
    if not prmt.confirm(q, 'n'):
        return

    # Build Static Page with Sphinx
    sp.run(['make', 'html'], cwd='sphinx')

    build_html_dir = 'sphinx/_build/html'

    if os.path.isfile(f"{build_html_dir}/index.html"):
        shutil.rmtree('docs', ignore_errors=True)
        shutil.copytree(build_html_dir, 'docs')
        shutil.rmtree(build_html_dir, ignore_errors=True)

    # Create README.rst
    readme_str = ''
    docs = 'sphinx/intro/'
    files = [
        'github_readme_head.rst',
        'description.rst',
        'subscribe.rst',
        'requirements.rst',
        'github_readme_tail.rst',
    ]

    for filename in files:
        with open(docs + filename, 'r') as f:
            readme_str += f.read()

    with open('README.rst', 'w') as f:
        f.write(readme_str)
Beispiel #6
0
def test_confirm():

    b = prmt.confirm(question='Confirm [y|n]:')
    b = prmt.confirm(question='Confirm [y|n] (Default):', default='y')