diff options
-rw-r--r-- | dev-requirements.txt | 2 | ||||
-rw-r--r-- | docs/doing-a-release.rst | 2 | ||||
-rw-r--r-- | release.py (renamed from tasks.py) | 33 |
3 files changed, 24 insertions, 13 deletions
diff --git a/dev-requirements.txt b/dev-requirements.txt index ab458448..3213f1e5 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ +click clint coverage -invoke requests tox >= 2.4.1 twine diff --git a/docs/doing-a-release.rst b/docs/doing-a-release.rst index 2da2c80a..7cf012bb 100644 --- a/docs/doing-a-release.rst +++ b/docs/doing-a-release.rst @@ -42,7 +42,7 @@ The commit that merged the version number bump is now the official release commit for this release. You will need to have ``gpg`` installed and a ``gpg`` key in order to do a release. Once this has happened: -* Run ``invoke release {version}``. +* Run ``python release.py {version}``. The release should now be available on PyPI and a tag should be available in the repository. @@ -7,11 +7,12 @@ from __future__ import absolute_import, division, print_function import getpass import io import os +import subprocess import time -from clint.textui.progress import Bar as ProgressBar +import click -import invoke +from clint.textui.progress import Bar as ProgressBar import requests @@ -19,6 +20,11 @@ import requests JENKINS_URL = "https://jenkins.cryptography.io/job/cryptography-wheel-builder" +def run(*args, **kwargs): + kwargs.setdefault("stderr", subprocess.STDOUT) + subprocess.check_output(list(args), **kwargs) + + def wait_for_build_completed(session): # Wait 20 seconds before actually checking if the build is complete, to # ensure that it had time to really start. @@ -95,20 +101,21 @@ def download_artifacts(session): return paths -@invoke.task +@click.command() +@click.argument("version") def release(version): """ ``version`` should be a string like '0.4' or '1.0'. """ - invoke.run("git tag -s {0} -m '{0} release'".format(version)) - invoke.run("git push --tags") + run("git", "tag", "-s", version, "-m", "{0} release".format(version)) + run("git", "push", "--tags") - invoke.run("python setup.py sdist") - invoke.run("cd vectors/ && python setup.py sdist bdist_wheel") + run("python", "setup.py", "sdist") + run("python", "setup.py", "sdist", "bdist_wheel", cwd="vectors/") - invoke.run( - "twine upload -s dist/cryptography-{0}* " - "vectors/dist/cryptography_vectors-{0}*".format(version) + run( + "twine", "upload", "-s", "dist/cryptography-{0}*".format(version), + "vectors/dist/cryptography_vectors-{0}*".format(version), shell=True ) session = requests.Session() @@ -135,4 +142,8 @@ def release(version): response.raise_for_status() wait_for_build_completed(session) paths = download_artifacts(session) - invoke.run("twine upload {0}".format(" ".join(paths))) + run("twine", "upload", " ".join(paths)) + + +if __name__ == "__main__": + release() |