From 6bc3af75b89fdae5534b65527453c183645ad394 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 6 Jan 2014 12:04:53 -0800 Subject: Write release automation software. Fixes #375 --- tasks.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tasks.py (limited to 'tasks.py') 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)) -- cgit v1.2.3 From 0e10f57d1b70ada1c4c0a6463d91dc0510a6b1d0 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 6 Jan 2014 13:17:31 -0800 Subject: Boilerplate woo! --- tasks.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tasks.py') diff --git a/tasks.py b/tasks.py index 4cbbe1a3..27eed304 100644 --- a/tasks.py +++ b/tasks.py @@ -1,3 +1,17 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from __future__ import absolute_import, division, print_function + import os import re -- cgit v1.2.3 From 7b8ef39ebe77b7686c34a2ffdef2c39e387760cb Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 6 Jan 2014 15:16:49 -0800 Subject: Fix --- tasks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tasks.py') diff --git a/tasks.py b/tasks.py index 27eed304..5db7a617 100644 --- a/tasks.py +++ b/tasks.py @@ -39,9 +39,9 @@ def release(version): # 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") + update_version("cryptography/__about__.py", "__version__", version) + update_version("docs/conf.py", "version", version) + update_version("docs/conf.py", "release", version) invoke.run("git commit -am 'Bump version numbers for release.'") invoke.run("git push") -- cgit v1.2.3 From d42fd94fa20d90691c4f63e7f299000ba9bb5b0e Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 6 Jan 2014 15:27:28 -0800 Subject: Suggestion from @dreid --- tasks.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tasks.py') diff --git a/tasks.py b/tasks.py index 5db7a617..bb30194a 100644 --- a/tasks.py +++ b/tasks.py @@ -44,9 +44,8 @@ def release(version): update_version("docs/conf.py", "release", version) 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("git push --all --tags") invoke.run("python setup.py sdist bdist_wheel") invoke.run("twine upload -s dist/cryptography-{}*".format(version)) -- cgit v1.2.3 From 6b1235a3ab4b1f93d3b5e2b78b77658013637aa2 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 6 Jan 2014 15:28:59 -0800 Subject: Simplify --- tasks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tasks.py') diff --git a/tasks.py b/tasks.py index bb30194a..5db7a617 100644 --- a/tasks.py +++ b/tasks.py @@ -44,8 +44,9 @@ def release(version): update_version("docs/conf.py", "release", version) 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 --all --tags") + invoke.run("git push --tags") invoke.run("python setup.py sdist bdist_wheel") invoke.run("twine upload -s dist/cryptography-{}*".format(version)) -- cgit v1.2.3 From 8755dbd309ae4eab754385853ac6959bfade588d Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 6 Jan 2014 15:35:18 -0800 Subject: Fix --- tasks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tasks.py') diff --git a/tasks.py b/tasks.py index 5db7a617..dba760ca 100644 --- a/tasks.py +++ b/tasks.py @@ -25,7 +25,8 @@ def update_version(filename, identifier, version): contents = re.sub( r"^{} = .*?$".format(identifier), '{} = "{}"'.format(identifier, version), - contents + contents, + flags=re.MULTILINE ) with open(path, "w") as f: f.write(contents) -- cgit v1.2.3 From 89063f687893417e1e5dac2e854a02d92037b6a0 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 6 Jan 2014 15:52:38 -0800 Subject: Update procedure --- tasks.py | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'tasks.py') diff --git a/tasks.py b/tasks.py index dba760ca..5fe28718 100644 --- a/tasks.py +++ b/tasks.py @@ -12,40 +12,14 @@ # limitations under the License. from __future__ import absolute_import, division, print_function -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, - flags=re.MULTILINE - ) - 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__", version) - update_version("docs/conf.py", "version", version) - update_version("docs/conf.py", "release", version) - - 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") -- cgit v1.2.3 From fea893c7060c57fe5ed9e0f9df58fee5c306681b Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 7 Jan 2014 11:06:51 -0800 Subject: More stuff --- tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tasks.py') diff --git a/tasks.py b/tasks.py index 5fe28718..ca967f0d 100644 --- a/tasks.py +++ b/tasks.py @@ -23,5 +23,5 @@ def release(version): invoke.run("git tag -s {}".format(version)) invoke.run("git push --tags") - invoke.run("python setup.py sdist bdist_wheel") + invoke.run("python setup.py sdist") invoke.run("twine upload -s dist/cryptography-{}*".format(version)) -- cgit v1.2.3 From 4345c0d3e65132985afb3f5a7fee04ea212811a0 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 7 Jan 2014 11:12:47 -0800 Subject: Python 2.6 support --- tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tasks.py') diff --git a/tasks.py b/tasks.py index ca967f0d..f72f43ba 100644 --- a/tasks.py +++ b/tasks.py @@ -20,8 +20,8 @@ def release(version): """ ``version`` should be a string like '0.4' or '1.0'. """ - invoke.run("git tag -s {}".format(version)) + invoke.run("git tag -s {0}".format(version)) invoke.run("git push --tags") invoke.run("python setup.py sdist") - invoke.run("twine upload -s dist/cryptography-{}*".format(version)) + invoke.run("twine upload -s dist/cryptography-{0}*".format(version)) -- cgit v1.2.3