forked from shadowbq/robust-atd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.py
59 lines (50 loc) · 1.67 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
import importlib
import os
from invoke import task
import invoke
@task
def clean(ctx,docs=False, bytecode=True, extra=''):
""" Clean up docs, bytecode, and extras """
patterns = ['build', 'dist', '*.egg-info', 'pyclient.log']
if docs:
patterns.append('docs/_build')
if bytecode:
patterns.append('**/**/*.pyc')
patterns.append('**/*.pyc')
patterns.append('./*.pyc')
if extra:
patterns.append(extra)
for pattern in patterns:
print ("Clearing rm -rf %s" % pattern)
ctx.run("rm -rf %s" % pattern)
@task
def smell(ctx):
""" Run flake8 PeP8 tests """
ctx.run("flake8 ratd")
@task
def codestats(ctx):
""" Run flake8 PeP8 tests for code stats """
ctx.run("flake8 ratd --statistics -qq")
@task
def build(ctx, docs=False):
""" Build the setup.py """
ctx.run("python setup.py build")
if docs:
ctx.run("sphinx-build docs docs/_build")
@task(pre=[clean], post=[codestats])
def test(ctx):
""" Run Unit tests """
ctx.run("cd ratd && nosetests --rednose test/tests.py test/test_clitools.py")
@task
def release(ctx,version):
"""``version`` should be a string like '0.4' or '1.0'."""
ctx.run("git tag -a robust-atd-{0} -m \"robust-atd {0} release\"".format(version))
ctx.run("git push --tags")
# https://packaging.python.org/tutorials/distributing-packages/#source-distributions
ctx.run("python setup.py sdist")
# https://packaging.python.org/tutorials/distributing-packages/#pure-python-wheels
ctx.run("python setup.py sdist bdist_wheel")
# Publish to pypi
# @task
# def publish(ctx,version)
# ctx.run("twine upload -r pypi dist/robust-atd-{0}*".format(version))