-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.py
74 lines (52 loc) · 1.53 KB
/
tasks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
from invoke import task, run
docs_dir = 'docs'
build_dir = os.path.join(docs_dir, '_build')
@task
def test(ctx):
run('python setup.py test', pty=True)
@task
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.")
@task
def clean_docs(ctx):
ctx.run("rm -rf %s" % build_dir)
@task
def browse_docs(ctx):
ctx.run("open %s" % os.path.join(build_dir, 'index.html'))
@task
def build_docs(ctx, clean=False, browse=False):
if clean:
clean_docs()
ctx.run("sphinx-build %s %s" % (docs_dir, build_dir), pty=True)
if browse:
browse_docs()
@task
def readme(ctx, browse=False):
ctx.run('rst2html.py README.rst > README.html')
@task
def build(ctx):
"""Build source distribution and wheels."""
ctx.run('python setup.py sdist bdist_wheel')
@task
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:
ctx.run('twine upload -r test dist/*')
else:
ctx.run("twine upload dist/*")