aboutsummaryrefslogtreecommitdiffstats
path: root/tasks.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-01-06 12:04:53 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2014-01-06 12:04:53 -0800
commit6bc3af75b89fdae5534b65527453c183645ad394 (patch)
tree7942dbc41321715ebf08dba3e7f6d0d7327c38b9 /tasks.py
parent3450b0e1376d8738e4cf05a8541827f0949b6d6a (diff)
downloadcryptography-6bc3af75b89fdae5534b65527453c183645ad394.tar.gz
cryptography-6bc3af75b89fdae5534b65527453c183645ad394.tar.bz2
cryptography-6bc3af75b89fdae5534b65527453c183645ad394.zip
Write release automation software. Fixes #375
Diffstat (limited to 'tasks.py')
-rw-r--r--tasks.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/tasks.py b/tasks.py
new file mode 100644
index 00000000..4cbbe1a3
--- /dev/null
+++ b/tasks.py
@@ -0,0 +1,38 @@
+import os
+import re
+
+import invoke
+
+
+def update_version(filename, identifier, version):
+ path = os.path.join(os.path.dirname(__file__), filename)
+ with open(path) as f:
+ contents = f.read()
+ contents = re.sub(
+ r"^{} = .*?$".format(identifier),
+ '{} = "{}"'.format(identifier, version),
+ contents
+ )
+ with open(path, "w") as f:
+ f.write(contents)
+
+
+@invoke.task
+def release(version):
+ """
+ ``version`` should be a string like '0.4' or '1.0'.
+ """
+ # This checks for changes in the repo.
+ invoke.run("git diff-index --quiet HEAD")
+
+ update_version("cryptography/__about__.py", "__version__")
+ update_version("docs/conf.py", "version")
+ update_version("docs/conf.py", "release")
+
+ invoke.run("git commit -am 'Bump version numbers for release.'")
+ invoke.run("git push")
+ invoke.run("git tag -s {}".format(version))
+ invoke.run("git push --tags")
+
+ invoke.run("python setup.py sdist bdist_wheel")
+ invoke.run("twine upload -s dist/cryptography-{}*".format(version))