-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
tasks.py
38 lines (27 loc) · 898 Bytes
/
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
from invoke import run as _run, task
from functools import partial
# Always echo out the commands
run = partial(_run, echo=True, pty=True)
@task
def lint(verbose=False):
"Run flake8 linter"
run('tox -e flake8{0}'.format(' -- -v' if verbose else ''))
@task(lint)
def test(verbose=False):
"Run tests using tox"
run('tox --skip-missing-interpreters{0}'.format(' -- -v' if verbose else ''))
@task
def clean():
"Clean working directory"
run('rm -rf *.egg-info *.egg')
run('rm -rf dist build')
@task(clean)
def release():
"Cut a new release"
version = run('python setup.py --version').stdout.strip()
assert version, 'No version found in setup.py?'
print('### Releasing new version: {0}'.format(version))
run('git tag {0}'.format(version))
run('git push --tags')
run('python setup.py sdist bdist_wheel')
run('twine upload -s dist/*')