From 4835f01c41f784e1bcd24752dfecb96eb44a1a16 Mon Sep 17 00:00:00 2001 From: con-f-use Date: Fri, 14 Feb 2020 11:23:43 +0100 Subject: use finalize_distribution_options entrypoint order fixes #1993 --- setuptools/dist.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setuptools/dist.py b/setuptools/dist.py index fe5adf46..f6453a08 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -731,13 +731,13 @@ class Distribution(_Distribution): to influence the order of execution. Smaller numbers go first and the default is 0. """ - hook_key = 'setuptools.finalize_distribution_options' + group = 'setuptools.finalize_distribution_options' def by_order(hook): return getattr(hook, 'order', 0) - eps = pkg_resources.iter_entry_points(hook_key) + eps = map(lambda e: e.load(), pkg_resources.iter_entry_points(group)) for ep in sorted(eps, key=by_order): - ep.load()(self) + ep(self) def _finalize_setup_keywords(self): for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'): -- cgit v1.2.1 From 3f8fb00e442d110129e7d77b8104e4774a11ef92 Mon Sep 17 00:00:00 2001 From: con-f-use Date: Sat, 15 Feb 2020 11:12:32 +0100 Subject: changelog for #1994 --- changelog.d/1994.change.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/1994.change.rst diff --git a/changelog.d/1994.change.rst b/changelog.d/1994.change.rst new file mode 100644 index 00000000..4a6cc742 --- /dev/null +++ b/changelog.d/1994.change.rst @@ -0,0 +1 @@ +Fixed a bug in the "setuptools.finalize_distribution_options" hook that lead to ignoring the order attribute of entry points managed by this hook. -- cgit v1.2.1 From b1abc23f0124de8ad99149674613ff8e2c71706a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 8 Mar 2020 16:37:43 -0400 Subject: Replace playbook with code for finalizing a release. --- docs/releases.txt | 40 +++++++------------------------------ tools/finalize.py | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tox.ini | 7 +++++++ 3 files changed, 73 insertions(+), 33 deletions(-) create mode 100644 tools/finalize.py diff --git a/docs/releases.txt b/docs/releases.txt index 98ba39e8..35b415c2 100644 --- a/docs/releases.txt +++ b/docs/releases.txt @@ -3,39 +3,13 @@ Release Process =============== In order to allow for rapid, predictable releases, Setuptools uses a -mechanical technique for releases, enacted by Travis following a -successful build of a tagged release per -`PyPI deployment `_. - -Prior to cutting a release, please use `towncrier`_ to update -``CHANGES.rst`` to summarize the changes since the last release. -To update the changelog: - -1. Install towncrier via ``pip install towncrier`` if not already installed. -2. Preview the new ``CHANGES.rst`` entry by running - ``towncrier --draft --version {new.version.number}`` (enter the desired - version number for the next release). If any changes are needed, make - them and generate a new preview until the output is acceptable. Run - ``git add`` for any modified files. -3. Run ``towncrier --version {new.version.number}`` to stage the changelog - updates in git. -4. Verify that there are no remaining ``changelog.d/*.rst`` files. If a - file was named incorrectly, it may be ignored by towncrier. -5. Review the updated ``CHANGES.rst`` file. If any changes are needed, - make the edits and stage them via ``git add CHANGES.rst``. - -Once the changelog edits are staged and ready to commit, cut a release by -installing and running ``bump2version --allow-dirty {part}`` where ``part`` -is major, minor, or patch based on the scope of the changes in the -release. Then, push the commits to the master branch:: - - $ git push origin master - $ git push --tags - -If tests pass, the release will be uploaded to PyPI (from the Python 3.6 -tests). - -.. _towncrier: https://pypi.org/project/towncrier/ +mechanical technique for releases, enacted on tagged commits by +continuous integration. + +To finalize a release, run ``tox -e finalize``, review, then push +the changes. + +If tests pass, the release will be uploaded to PyPI. Release Frequency ----------------- diff --git a/tools/finalize.py b/tools/finalize.py new file mode 100644 index 00000000..3b66341a --- /dev/null +++ b/tools/finalize.py @@ -0,0 +1,59 @@ +""" +Finalize the repo for a release. Invokes towncrier and bumpversion. +""" + +__requires__ = ['bump2version', 'towncrier'] + + +import subprocess +import pathlib +import re +import sys + + +def release_kind(): + """ + Determine which release to make based on the files in the + changelog. + """ + # use min here as 'major' < 'minor' < 'patch' + return min( + 'major' if 'breaking' in file.name else + 'minor' if 'change' in file.name else + 'patch' + for file in pathlib.Path('changelog.d').iterdir() + ) + + +bump_version_command = [ + sys.executable, + '-m', 'bumpversion', + release_kind(), +] + + +def get_version(): + cmd = bump_version_command + ['--dry-run', '--verbose'] + out = subprocess.check_output(cmd, text=True) + return re.search('^new_version=(.*)', out, re.MULTILINE).group(1) + + +def update_changelog(): + cmd = [ + sys.executable, '-m', + 'towncrier', + '--version', get_version(), + '--yes', + ] + subprocess.check_call(cmd) + + +def bump_version(): + cmd = bump_version_command + ['--allow-dirty'] + subprocess.check_call(cmd) + + +if __name__ == '__main__': + print("Cutting release at", get_version()) + update_changelog() + bump_version() diff --git a/tox.ini b/tox.ini index 2d43e76f..b1069220 100644 --- a/tox.ini +++ b/tox.ini @@ -58,6 +58,13 @@ source= omit= */_vendor/* +[testenv:finalize] +deps = + towncrier + bump2version +commands = + python tools/finalize.py + [testenv:release] skip_install = True deps = -- cgit v1.2.1 From c020b5f88579487350ea38a40d3ea2cab1318144 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 8 Mar 2020 16:40:07 -0400 Subject: Avoid install during finalize --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index b1069220..3fc6a564 100644 --- a/tox.ini +++ b/tox.ini @@ -59,6 +59,7 @@ omit= */_vendor/* [testenv:finalize] +skip_install = True deps = towncrier bump2version -- cgit v1.2.1 From 1988125e800b3b64f9cf9311fea5525cc81546f9 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 21 Mar 2020 14:41:31 -0400 Subject: =?UTF-8?q?Bump=20version:=2044.0.0=20=E2=86=92=2044.1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 3 +-- CHANGES.rst | 8 ++++++++ changelog.d/1704.change.rst | 1 - changelog.d/1959.change.rst | 1 - changelog.d/1994.change.rst | 1 - setup.cfg | 2 +- 6 files changed, 10 insertions(+), 6 deletions(-) delete mode 100644 changelog.d/1704.change.rst delete mode 100644 changelog.d/1959.change.rst delete mode 100644 changelog.d/1994.change.rst diff --git a/.bumpversion.cfg b/.bumpversion.cfg index e1bfa898..c8c9f544 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,7 +1,6 @@ [bumpversion] -current_version = 44.0.0 +current_version = 44.1.0 commit = True tag = True [bumpversion:file:setup.cfg] - diff --git a/CHANGES.rst b/CHANGES.rst index 109a3f48..83cd8c78 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,11 @@ +v44.1.0 +------- + +* #1704: Set sys.argv[0] in setup script run by build_meta.__legacy__ +* #1959: Fix for Python 4: replace unsafe six.PY3 with six.PY2 +* #1994: Fixed a bug in the "setuptools.finalize_distribution_options" hook that lead to ignoring the order attribute of entry points managed by this hook. + + v44.0.0 ------- diff --git a/changelog.d/1704.change.rst b/changelog.d/1704.change.rst deleted file mode 100644 index 62450835..00000000 --- a/changelog.d/1704.change.rst +++ /dev/null @@ -1 +0,0 @@ -Set sys.argv[0] in setup script run by build_meta.__legacy__ diff --git a/changelog.d/1959.change.rst b/changelog.d/1959.change.rst deleted file mode 100644 index c0cc8975..00000000 --- a/changelog.d/1959.change.rst +++ /dev/null @@ -1 +0,0 @@ -Fix for Python 4: replace unsafe six.PY3 with six.PY2 diff --git a/changelog.d/1994.change.rst b/changelog.d/1994.change.rst deleted file mode 100644 index 4a6cc742..00000000 --- a/changelog.d/1994.change.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed a bug in the "setuptools.finalize_distribution_options" hook that lead to ignoring the order attribute of entry points managed by this hook. diff --git a/setup.cfg b/setup.cfg index ecef8609..cb5ae73b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,7 +19,7 @@ universal = 1 [metadata] name = setuptools -version = 44.0.0 +version = 44.1.0 description = Easily download, build, install, upgrade, and uninstall Python packages author = Python Packaging Authority author_email = distutils-sig@python.org -- cgit v1.2.1