mirror of https://github.com/pypa/pip
Use nox for release tasks
Merge pull request #6937 from pradyunsg/use-nox
This commit is contained in:
commit
dc2dff3a0b
|
@ -15,13 +15,13 @@ jobs:
|
||||||
inputs:
|
inputs:
|
||||||
versionSpec: '3'
|
versionSpec: '3'
|
||||||
|
|
||||||
- bash: pip install setuptools tox wheel invoke towncrier requests
|
- bash: pip install tox nox setuptools wheel
|
||||||
displayName: Install dependencies
|
displayName: Install dependencies
|
||||||
|
|
||||||
- bash: invoke generate.authors
|
- bash: nox -s generate_authors
|
||||||
displayName: Generate AUTHORS.txt
|
displayName: Generate AUTHORS.txt
|
||||||
|
|
||||||
- bash: invoke generate.news --yes
|
- bash: nox -s generate_news -- --yes
|
||||||
displayName: Generate NEWS.rst
|
displayName: Generate NEWS.rst
|
||||||
|
|
||||||
- bash: tox -e packaging
|
- bash: tox -e packaging
|
||||||
|
|
|
@ -18,7 +18,7 @@ docs/build/
|
||||||
.mypy_cache/
|
.mypy_cache/
|
||||||
|
|
||||||
# Unit test / coverage reports
|
# Unit test / coverage reports
|
||||||
.tox/
|
.[nt]ox/
|
||||||
htmlcov/
|
htmlcov/
|
||||||
.coverage
|
.coverage
|
||||||
.coverage.*
|
.coverage.*
|
||||||
|
|
|
@ -17,6 +17,7 @@ exclude .appveyor.yml
|
||||||
exclude .travis.yml
|
exclude .travis.yml
|
||||||
exclude .readthedocs.yml
|
exclude .readthedocs.yml
|
||||||
exclude tox.ini
|
exclude tox.ini
|
||||||
|
exclude noxfile.py
|
||||||
|
|
||||||
recursive-include src/pip/_vendor *.pem
|
recursive-include src/pip/_vendor *.pem
|
||||||
recursive-include docs Makefile *.rst *.py *.bat
|
recursive-include docs Makefile *.rst *.py *.bat
|
||||||
|
|
|
@ -80,14 +80,13 @@ Creating a new release
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
#. Checkout the current pip ``master`` branch.
|
#. Checkout the current pip ``master`` branch.
|
||||||
#. Ensure you have the latest ``wheel``, ``setuptools``, ``twine``, ``invoke``
|
#. Ensure you have the latest ``wheel``, ``setuptools``, ``twine`` and ``nox`` packages installed.
|
||||||
and ``towncrier`` packages installed.
|
#. Generate a new ``AUTHORS.txt`` (``nox -s generate_authors``) and commit the
|
||||||
#. Generate a new ``AUTHORS.txt`` (``invoke generate.authors``) and commit the
|
|
||||||
results.
|
results.
|
||||||
#. Bump the version in ``pip/__init__.py`` to the release version and commit
|
#. Bump the version in ``pip/__init__.py`` to the release version and commit
|
||||||
the results. Usually this involves dropping just the ``.devN`` suffix on the
|
the results. Usually this involves dropping just the ``.devN`` suffix on the
|
||||||
version.
|
version.
|
||||||
#. Generate a new ``NEWS.rst`` (``invoke generate.news``) and commit the
|
#. Generate a new ``NEWS.rst`` (``nox -s generate_news``) and commit the
|
||||||
results.
|
results.
|
||||||
#. Create a tag at the current commit, of the form ``YY.N``
|
#. Create a tag at the current commit, of the form ``YY.N``
|
||||||
(``git tag YY.N``).
|
(``git tag YY.N``).
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
"""Release time helpers, executed using nox.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import io
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
import nox
|
||||||
|
|
||||||
|
|
||||||
|
def get_author_list():
|
||||||
|
"""Get the list of authors from Git commits.
|
||||||
|
"""
|
||||||
|
# subprocess because session.run doesn't give us stdout
|
||||||
|
result = subprocess.run(
|
||||||
|
["git", "log", "--use-mailmap", "--format=%aN <%aE>"],
|
||||||
|
capture_output=True,
|
||||||
|
encoding="utf-8",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create a unique list.
|
||||||
|
authors = []
|
||||||
|
seen_authors = set()
|
||||||
|
for author in result.stdout.splitlines():
|
||||||
|
author = author.strip()
|
||||||
|
if author.lower() not in seen_authors:
|
||||||
|
seen_authors.add(author.lower())
|
||||||
|
authors.append(author)
|
||||||
|
|
||||||
|
# Sort our list of Authors by their case insensitive name
|
||||||
|
return sorted(authors, key=lambda x: x.lower())
|
||||||
|
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# Commands used during the release process
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
@nox.session
|
||||||
|
def generate_authors(session):
|
||||||
|
# Get our list of authors
|
||||||
|
session.log("Collecting author names")
|
||||||
|
authors = get_author_list()
|
||||||
|
|
||||||
|
# Write our authors to the AUTHORS file
|
||||||
|
session.log("Writing AUTHORS")
|
||||||
|
with io.open("AUTHORS.txt", "w", encoding="utf-8") as fp:
|
||||||
|
fp.write(u"\n".join(authors))
|
||||||
|
fp.write(u"\n")
|
||||||
|
|
||||||
|
|
||||||
|
@nox.session
|
||||||
|
def generate_news(session):
|
||||||
|
session.log("Generating NEWS")
|
||||||
|
session.install("towncrier")
|
||||||
|
|
||||||
|
# You can pass 2 possible arguments: --draft, --yes
|
||||||
|
session.run("towncrier", *session.posargs)
|
|
@ -1,6 +1,7 @@
|
||||||
[isort]
|
[isort]
|
||||||
skip =
|
skip =
|
||||||
./build,
|
./build,
|
||||||
|
.nox,
|
||||||
.tox,
|
.tox,
|
||||||
.scratch,
|
.scratch,
|
||||||
_vendor,
|
_vendor,
|
||||||
|
@ -17,6 +18,7 @@ include_trailing_comma = true
|
||||||
[flake8]
|
[flake8]
|
||||||
exclude =
|
exclude =
|
||||||
./build,
|
./build,
|
||||||
|
.nox,
|
||||||
.tox,
|
.tox,
|
||||||
.scratch,
|
.scratch,
|
||||||
_vendor,
|
_vendor,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import invoke
|
import invoke
|
||||||
|
|
||||||
from tools.automation import generate, vendoring
|
from tools.automation import vendoring
|
||||||
|
|
||||||
ns = invoke.Collection(generate, vendoring)
|
ns = invoke.Collection(vendoring)
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
import io
|
|
||||||
|
|
||||||
import invoke
|
|
||||||
|
|
||||||
|
|
||||||
@invoke.task
|
|
||||||
def authors(ctx):
|
|
||||||
print("[generate.authors] Generating AUTHORS")
|
|
||||||
|
|
||||||
# Get our list of authors
|
|
||||||
print("[generate.authors] Collecting author names")
|
|
||||||
|
|
||||||
# Note that it's necessary to use double quotes in the
|
|
||||||
# --format"=%aN <%aE>" part of the command, as the Windows
|
|
||||||
# shell doesn't recognise single quotes here.
|
|
||||||
r = ctx.run('git log --use-mailmap --format"=%aN <%aE>"',
|
|
||||||
encoding="utf-8", hide=True)
|
|
||||||
|
|
||||||
authors = []
|
|
||||||
seen_authors = set()
|
|
||||||
for author in r.stdout.splitlines():
|
|
||||||
author = author.strip()
|
|
||||||
if author.lower() not in seen_authors:
|
|
||||||
seen_authors.add(author.lower())
|
|
||||||
authors.append(author)
|
|
||||||
|
|
||||||
# Sort our list of Authors by their case insensitive name
|
|
||||||
authors = sorted(authors, key=lambda x: x.lower())
|
|
||||||
|
|
||||||
# Write our authors to the AUTHORS file
|
|
||||||
print("[generate.authors] Writing AUTHORS")
|
|
||||||
with io.open("AUTHORS.txt", "w", encoding="utf8") as fp:
|
|
||||||
fp.write(u"\n".join(authors))
|
|
||||||
fp.write(u"\n")
|
|
||||||
|
|
||||||
|
|
||||||
@invoke.task
|
|
||||||
def news(ctx, draft=False, yes=False):
|
|
||||||
print("[generate.news] Generating NEWS")
|
|
||||||
|
|
||||||
args = []
|
|
||||||
if draft:
|
|
||||||
args.append("--draft")
|
|
||||||
if yes:
|
|
||||||
args.append("--yes")
|
|
||||||
|
|
||||||
ctx.run("towncrier {}".format(" ".join(args)))
|
|
Loading…
Reference in New Issue