-
Notifications
You must be signed in to change notification settings - Fork 2
/
tasks.py
70 lines (49 loc) · 1.49 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
import re
from invoke.collection import Collection
from invoke.tasks import task
@task
def clean(ctx):
"""Cleans temporary artifacts of project."""
ignores = re.match(r'^#\sno-clean:\s(.*)$', open('.gitignore').readline()).group(1).split(' ')
ctx.run('git clean -f -X -d {}'.format(' '.join([r'-e \!' + re.escape(ign) for ign in ignores])))
@task
def develop(ctx):
"""Start development mode."""
ctx.run('pip install -e .')
@task
def undevelop(ctx):
"""Stop development mode."""
ctx.run('python setup.py develop --uninstall')
@task
def analyze(ctx):
"""Run static analysis."""
ctx.run('pylint pytest_voluptuous')
@task
def test(ctx):
"""Run unit tests."""
ctx.run('coverage run --append -m pytest')
ctx.run('coverage report')
@task
def package(ctx):
"""Packages module."""
ctx.run('python setup.py bdist_wheel')
@task
def tox(ctx):
"""Run tox."""
ctx.run('tox')
@task
def release(ctx, version):
"""Releases a new version of the library."""
ctx.run('git commit --allow-empty -m "Release {}"'.format(version))
ctx.run('git tag -a {0} -m "Release {0}"'.format(version))
ctx.run('git push')
ctx.run('git push --tags')
clean(ctx)
package(ctx)
upload(ctx)
@task
def upload(ctx):
"""Uploads packages to PyPI."""
ctx.run('twine check dist/pytest_voluptuous-*.whl')
ctx.run('twine upload dist/pytest_voluptuous-*.whl')
ns = Collection(clean, develop, undevelop, analyze, test, tox, package, release, upload)