-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.py
46 lines (35 loc) · 910 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
39
40
41
42
43
44
45
46
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: "Chris Ward" <[email protected]>
'''
Invoke Project Tasks
'''
# PY3 COMPAT
from __future__ import unicode_literals, absolute_import
import logging
from invoke import run, task
logging.basicConfig()
logr = logging.getLogger()
logr.setLevel(logging.INFO)
@task
def clean(docs=False, bytecode=True, extra=''):
logr.info('>> CLEAN')
patterns = ['build']
if docs:
patterns.append('docs/_build')
if bytecode:
patterns.append('**/*.pyc')
patterns.append('*.pyc')
if extra:
patterns.append(extra)
logr.info(' ... [{}]'.format(', '.join(patterns)))
for pattern in patterns:
run("rm -rf %s" % pattern)
@task
def build(docs=False):
run("python setup.py build")
if docs:
run("sphinx-build docs docs/_build")
@task
def deploy():
run("python setup.py sdist upload")