How to use the invocations.packaging.release.Changelog.NEEDS_RELEASE function in invocations

To help you get started, we’ve selected a few invocations examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyinvoke / invocations / tests / packaging / release.py View on Github external
def displays_expectations_and_component_statuses(self):
            _mock_status(self)

            # TODO: make things more organic/specific/less tabular:
            #
            # current git branch: xxx (implies type yyy)
            # changelog: xxx
            # so the next release would be: a.b.c (or: 'so the release we're
            # cutting/expecting is a.b.c')
            # version file: 
            # git tag:  (maybe including
            # latest that is found? that's extra logic...)
            # etc...

            parts = dict(
                changelog=Changelog.NEEDS_RELEASE.value,
                version=VersionFile.NEEDS_BUMP.value,
                tag=Tag.NEEDS_CUTTING.value,
            )
            for part in parts:
                parts[part] = re.escape(parts[part])
            parts["header_footer"] = r"-+ +-+"
            # NOTE: forces impl to follow specific order, which is good
            regex = r"""
{header_footer}
Changelog +{changelog}
Version +{version}
Tag +{tag}
{header_footer}
""".format(
                **parts
            ).strip()
github pyinvoke / invocations / tests / packaging / release.py View on Github external
def changelog_release_version_update_tag_cut(self):
                        # TODO: do we want some sort of "and here's _what_ you
                        # ought to be adding as the new release and/or version
                        # value" aspect to the actions? can leave up to user
                        # for now, but, more automation is better.
                        _expect_actions(
                            self,
                            Changelog.NEEDS_RELEASE,
                            VersionFile.NEEDS_BUMP,
                            Tag.NEEDS_CUTTING,
                        )
github pyinvoke / invocations / invocations / packaging / release.py View on Github external
# textual description, command string, etc. See the TODO up by their
    # definition too, re: just making them non-enum classes period.
    # TODO: otherwise, we at least want derived eg changelog/version/etc paths
    # transmitted from status() into here...
    actions, state = status(c)
    # TODO: unless nothing-to-do in which case just say that & exit 0
    if not confirm("Take the above actions?"):
        sys.exit("Aborting.")

    # TODO: factor out what it means to edit a file:
    # - $EDITOR or explicit expansion of it in case no shell involved
    # - pty=True and hide=False, because otherwise things can be bad
    # - what else?

    # Changelog! (pty for non shite editing, eg vim sure won't like non-pty)
    if actions.changelog is Changelog.NEEDS_RELEASE:
        # TODO: identify top of list and inject a ready-made line? Requires vim
        # assumption...GREAT opportunity for class/method based tasks!
        cmd = "$EDITOR {0.packaging.changelog_file}".format(c)
        c.run(cmd, pty=True, hide=False)
    # TODO: add a step for checking reqs.txt / setup.py vs virtualenv contents
    # Version file!
    if actions.version == VersionFile.NEEDS_BUMP:
        # TODO: suggest the bump and/or overwrite the entire file? Assumes a
        # specific file format. Could be bad for users which expose __version__
        # but have other contents as well.
        version_file = os.path.join(
            _find_package(c),
            c.packaging.get("version_module", "_version") + ".py",
        )
        cmd = "$EDITOR {0}".format(version_file)
        c.run(cmd, pty=True, hide=False)