From 61a0ce2c4ea9ce119f61f81100008869f5b60244 Mon Sep 17 00:00:00 2001 From: Bernat Gabor Date: Mon, 8 Oct 2018 10:24:11 +0100 Subject: [PATCH] fix release task and fix documentation for 3.5.0 --- changelog.rst | 28 ---------------------------- docs/changelog.rst | 29 +++++++++++++++++++++++++++++ pyproject.toml | 4 ++-- tasks/release.py | 13 ++++++++----- tox.ini | 3 ++- 5 files changed, 41 insertions(+), 36 deletions(-) delete mode 100644 changelog.rst diff --git a/changelog.rst b/changelog.rst deleted file mode 100644 index 7b03e5a5c..000000000 --- a/changelog.rst +++ /dev/null @@ -1,28 +0,0 @@ -3.5.0 (2018-10-08) ------------------- - -Bugfixes -^^^^^^^^ - -- intermittent failures with ``--parallel--safe-build``, instead of mangling with the file paths now uses a lock to make the package build operation thread safe and is now on by default (``--parallel--safe-build`` is now deprecated) - by :user:`gaborbernat` (`#1026 `_) - - -Features -^^^^^^^^ - -- Added ``temp_dir`` folder configuration (defaults to ``{toxworkdir}/.tmp``) that contains tox - temporary files. Package builds now create a hard link (if possible, otherwise copy - notably in - case of Windows Python 2.7) to the built file, and feed that file downstream (e.g. for pip to - install it). The hard link is removed at the end of the run (what it points though is kept - inside ``distdir``). This ensures that a tox session operates on the same package it built, even - if a parallel tox run builds another version. Note ``distdir`` will contain only the last built - package in such cases. - by :user:`gaborbernat` (`#1026 `_) - - -Documentation -^^^^^^^^^^^^^ - -- document tox environment recreate rules (:ref:`recreate`) - by :user:`gaborbernat` (`#93 `_) -- document inside the ``--help`` how to disable colorized output via the ``PY_COLORS`` operating system environment variable - by :user:`gaborbernat` (`#163 `_) -- document all global tox flags and a more concise format to express default and type - by :user:`gaborbernat` (`#683 `_) -- document command line interface under the config section `cli `_ - by :user:`gaborbernat` (`#829 `_) diff --git a/docs/changelog.rst b/docs/changelog.rst index 9d3eed86c..511378552 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -11,6 +11,35 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +v3.5.0 (2018-10-08) +------------------- + +Bugfixes +^^^^^^^^ + +- intermittent failures with ``--parallel--safe-build``, instead of mangling with the file paths now uses a lock to make the package build operation thread safe and is now on by default (``--parallel--safe-build`` is now deprecated) - by :user:`gaborbernat` (`#1026 `_) + + +Features +^^^^^^^^ + +- Added ``temp_dir`` folder configuration (defaults to ``{toxworkdir}/.tmp``) that contains tox + temporary files. Package builds now create a hard link (if possible, otherwise copy - notably in + case of Windows Python 2.7) to the built file, and feed that file downstream (e.g. for pip to + install it). The hard link is removed at the end of the run (what it points though is kept + inside ``distdir``). This ensures that a tox session operates on the same package it built, even + if a parallel tox run builds another version. Note ``distdir`` will contain only the last built + package in such cases. - by :user:`gaborbernat` (`#1026 `_) + + +Documentation +^^^^^^^^^^^^^ + +- document tox environment recreate rules (:ref:`recreate`) - by :user:`gaborbernat` (`#93 `_) +- document inside the ``--help`` how to disable colorized output via the ``PY_COLORS`` operating system environment variable - by :user:`gaborbernat` (`#163 `_) +- document all global tox flags and a more concise format to express default and type - by :user:`gaborbernat` (`#683 `_) +- document command line interface under the config section `cli `_ - by :user:`gaborbernat` (`#829 `_) + v3.4.0 (2018-09-20) ------------------- diff --git a/pyproject.toml b/pyproject.toml index ab919add2..e25a5d7ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,10 +8,10 @@ build-backend = 'setuptools.build_meta' [tool.towncrier] package = "tox" - filename = "changelog.rst" + filename = "docs/changelog.rst" directory = "docs/changelog" template = "docs/changelog/template.jinja2" - title_format = "{version} ({project_date})" + title_format = "v{version} ({project_date})" issue_format = "`#{issue} `_" underlines = ["-", "^"] diff --git a/tasks/release.py b/tasks/release.py index 76a478f1d..08d7bd377 100644 --- a/tasks/release.py +++ b/tasks/release.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- """Handles creating a release PR""" -import sys from pathlib import Path from subprocess import check_call from typing import Tuple @@ -17,7 +16,6 @@ def main(version_str: str) -> None: if repo.is_dirty(): raise RuntimeError("Current repository is dirty. Please commit any changes and try again.") - upstream, release_branch = create_release_branch(repo, version) release_commit = release_changelog(repo, version) tag = tag_release_commit(release_commit, repo, version) @@ -51,8 +49,8 @@ def get_upstream(repo: Repo) -> Remote: def release_changelog(repo: Repo, version: Version) -> Commit: print("generate release commit") check_call(["towncrier", "--yes", "--version", version.public], cwd=str(ROOT_SRC_DIR)) - changed = [item.a_path for item in repo.index.diff(None)] - if any((not i.startswith("changelog") or i == "changelog.rst") for i in changed): + changed = [item.a_path for item in repo.index.diff("HEAD")] + if any(not i.startswith("docs/changelog") for i in changed): raise RuntimeError(f"found changes outside of the changelog domain: {changed}") repo.index.add(changed) release_commit = repo.index.commit(f"release {version}") @@ -71,4 +69,9 @@ def tag_release_commit(release_commit, repo, version) -> TagReference: if __name__ == "__main__": - main(sys.argv[1]) + import argparse + + parser = argparse.ArgumentParser(prog="release") + parser.add_argument("--version", required=True) + options = parser.parse_args() + main(options.version) diff --git a/tox.ini b/tox.ini index b975d0af9..1166b57ff 100644 --- a/tox.ini +++ b/tox.ini @@ -152,7 +152,8 @@ passenv = * deps = gitpython >= 2.1.10 towncrier >= 18.5.0 packaging >= 17.1 -commands = python {toxinidir}/tasks/release.py {posargs} +skip_install = true +commands = python {toxinidir}/tasks/release.py --version {posargs} [testenv:notify] description = notify people about the release of the library