path: root/tasks.py
diff options
authorTrevor Bramwell <tbramwell@linuxfoundation.org>2017-07-10 23:38:36 -0700
committerTrevor Bramwell <tbramwell@linuxfoundation.org>2017-07-11 08:25:07 -0700
commitd8339203125f9eafb567f6ae2d784fe532046837 (patch)
treec3c9da09aa3f23bb993f6ffa78b8af9a199f3eac /tasks.py
parent4348462d9e221586448375a46aef3eff04407535 (diff)
Update Invoke Tasks and use Twine for upload
None of the tasks generated by the boilerplate included the 'context' argument required by the newest version of invoke. The 'invoke publish' task has been updated to use 'twine upload' instead of the less-secure 'python setup.py register/upload', and comments have been added to clarify possible steps needed to publish anteater. A 'invoke build' command has been added to build a source distribution and binary wheel distribution. JIRA: RELENG-237 Change-Id: I9ae705332b592ef8880d52b7d20624180e23677a Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Diffstat (limited to 'tasks.py')
1 files changed, 35 insertions, 18 deletions
diff --git a/tasks.py b/tasks.py
index 55ac340..30bef4c 100644
--- a/tasks.py
+++ b/tasks.py
@@ -11,47 +11,64 @@ build_dir = os.path.join(docs_dir, '_build')
-def test():
+def test(ctx):
run('python setup.py test', pty=True)
-def clean():
- run("rm -rf build")
- run("rm -rf dist")
- run("rm -rf anteater.egg-info")
- clean_docs()
+def clean(ctx):
+ ctx.run("rm -rf build")
+ ctx.run("rm -rf dist")
+ ctx.run("rm -rf anteater.egg-info")
+ clean_docs(ctx)
print("Cleaned up.")
-def clean_docs():
- run("rm -rf %s" % build_dir)
+def clean_docs(ctx):
+ ctx.run("rm -rf %s" % build_dir)
-def browse_docs():
- run("open %s" % os.path.join(build_dir, 'index.html'))
+def browse_docs(ctx):
+ ctx.run("open %s" % os.path.join(build_dir, 'index.html'))
-def build_docs(clean=False, browse=False):
+def build_docs(ctx, clean=False, browse=False):
if clean:
- run("sphinx-build %s %s" % (docs_dir, build_dir), pty=True)
+ ctx.run("sphinx-build %s %s" % (docs_dir, build_dir), pty=True)
if browse:
-def readme(browse=False):
- run('rst2html.py README.rst > README.html')
+def readme(ctx, browse=False):
+ ctx.run('rst2html.py README.rst > README.html')
-def publish(test=False):
- """Publish to the cheeseshop."""
+def build(ctx):
+ """Build source distribution and wheels."""
+ ctx.run('python setup.py sdist bdist_wheel')
+def publish(ctx, test=False):
+ """Publish to the cheeseshop.
+ This command follows the Python packaging guidelines:
+ https://packaging.python.org/tutorials/distributing-packages
+ Information on configuration required for '--test' can be found
+ here: https://wiki.python.org/moin/TestPyPI
+ Before uploading please ensure you've signed the release using:
+ gpg --detach-sign -a dist/package-1.0.1.tar.gz
+ """
if test:
- run('python setup.py register -r test sdist upload -r test')
+ ctx.run('twine upload -r test dist/*')
- run("python setup.py register sdist upload")
+ ctx.run("twine upload dist/*")