forked from illagrenan/block-timer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.py
73 lines (53 loc) · 1.73 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
# -*- encoding: utf-8 -*-
# ! python3
import shutil
from invoke import run, task
@task
def clean():
"""remove build artifacts"""
shutil.rmtree('block_timer.egg-info', ignore_errors=True)
shutil.rmtree('build', ignore_errors=True)
shutil.rmtree('dist', ignore_errors=True)
shutil.rmtree('htmlcov', ignore_errors=True)
shutil.rmtree('__pycache__', ignore_errors=True)
@task
def lint():
"""check style with flake8"""
run("flake8 block_timer/ tests/")
@task
def test():
run("py.test --verbose --showlocals tests/")
@task
def check():
"""run tests quickly with the default Python"""
run("python setup.py --no-user-cfg --verbose check --metadata --restructuredtext --strict")
@task
def coverage():
"""check code coverage quickly with the default Python"""
run("coverage run --source block_timer -m py.test")
run("coverage report -m")
run("coverage html")
@task
def test_install():
"""try to install built package"""
run("pip uninstall block-timer --yes", warn=True)
run("pip install --use-wheel --no-index --find-links=file:./dist block-timer")
run("pip uninstall block-timer --yes")
@task
def build():
"""build package"""
run("python setup.py build")
run("python setup.py sdist")
run("python setup.py bdist_wheel")
@task
def publish():
"""publish package"""
check()
run('python setup.py sdist upload -r pypi') # Use python setup.py REGISTER
run('python setup.py bdist_wheel upload -r pypi')
@task
def publish_test():
"""publish package"""
check()
run('python setup.py sdist upload -r https://testpypi.python.org/pypi') # Use python setup.py REGISTER
run('python setup.py bdist_wheel upload -r https://testpypi.python.org/pypi')