forked from LI3DS/api-li3ds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.py
53 lines (37 loc) · 1.17 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
# -*- coding: utf-8 -*-
from os.path import join, abspath, dirname
from pathlib import Path
from invoke import run, task
HERE = abspath(join(dirname(__file__)))
@task
def clean(ctx, docs=False, bytecode=False, extra=''):
'''Cleanup all build artifacts'''
patterns = ['build', 'dist', 'cover', 'docs/_build', '**/*.pyc', '*.egg-info', '.tox']
for pattern in patterns:
print('Removing {0}'.format(pattern))
run('cd {0} && rm -rf {1}'.format(HERE, pattern))
@task
def test(ctx):
'''Run tests suite'''
run('cd {0} && py.test'.format(HERE), pty=True)
@task
def tox(ctx):
'''Run test in all Python versions'''
run('tox',
pty=True,
env={'API_LI3DS_SETTINGS': str((Path(__file__).parent / 'conf' / 'api_li3ds.yml').resolve())})
@task
def doc(ctx):
'''Build the documentation'''
run('cd {0}/doc && make html'.format(HERE), pty=True)
@task
def dist(ctx):
'''Package for distribution'''
run('cd {0} && python setup.py sdist bdist_wheel'.format(HERE), pty=True)
@task
def release_pypi(ctx):
'''Upload release to pypi'''
run('echo release to pypi')
@task(tox, doc, dist, default=True)
def all(ctx):
pass