Skip to content

Commit

Permalink
build: automate the 'final' version
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Nov 15, 2024
1 parent e1502e6 commit ad4a4ff
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,15 @@ sample_html_beta: _sample_cog_html ## Generate sample HTML report for a beta rel

##@ Kitting: making releases

.PHONY: edit_for_release cheats relbranch relcommit1 relcommit2
.PHONY: release_version edit_for_release cheats relbranch relcommit1 relcommit2
.PHONY: kit pypi_upload test_upload kit_local build_kits
.PHONY: tag bump_version

REPO_OWNER = nedbat/coveragepy

release_version: #: Update the version for a release.
python igor.py release_version

edit_for_release: #: Edit sources to insert release facts (see howto.txt).
python igor.py edit_for_release

Expand Down
11 changes: 7 additions & 4 deletions howto.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
- Check that the current virtualenv matches the current coverage branch.
- start branch for release work
$ make relbranch
- Edit version number in coverage/version.py
- check version number in coverage/version.py
- IF PRE-RELEASE:
- edit to look like one of these:
version_info = (4, 0, 2, "alpha", 1)
version_info = (4, 0, 2, "beta", 1)
version_info = (4, 0, 2, "candidate", 1)
version_info = (4, 0, 2, "final", 0)
- make sure: _dev = 0
- Edit supported Python version numbers. Search for "PYVERSIONS".
- Especially README.rst and doc/index.rst
- IF NOT PRE-RELEASE:
$ make release_version
- Update source files with release facts, and get useful snippets:
$ make edit_for_release cheats
- Edit supported Python version numbers. Search for "PYVERSIONS".
- Especially README.rst and doc/index.rst
- Look over CHANGES.rst
- Update README.rst
- "New in x.y:"
Expand Down
9 changes: 9 additions & 0 deletions igor.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,15 @@ def do_edit_for_release():
)
update_file("doc/conf.py", r"(?s)# @@@ editable\n.*# @@@ end\n", new_conf)

def do_release_version():
"""Set the version to 'final' for a release."""
facts = get_release_facts()
rel_vi = facts.vi[:3] + ("final", 0)
rel_version = f"version_info = {rel_vi}\n_dev = 0".replace("'", '"')
update_file(
"coverage/version.py", r"(?m)^version_info = .*\n_dev = \d+$", rel_version,
)


def do_bump_version():
"""Edit a few files right after a release to bump the version."""
Expand Down

0 comments on commit ad4a4ff

Please sign in to comment.