-
Notifications
You must be signed in to change notification settings - Fork 1
/
tasks.py
46 lines (33 loc) · 884 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
from invoke import (
task,
run
)
# define projects directories
tools_dir = 'tools'
prototype_dir = 'prototype'
@task
def pep8():
cmd = 'pep8 tasks.py ' + tools_dir + ' ' + prototype_dir
run_cmd(cmd)
@task
def pyflakes():
cmd = 'pyflakes tasks.py ' + tools_dir + ' ' + prototype_dir
run_cmd(cmd)
@task('pep8', 'pyflakes')
def check():
pass
@task
def clean():
run_cmd("find . -name '__pycache__' -exec rm -rf {} +")
run_cmd("find . -name '*.pyc' -exec rm -f {} +")
run_cmd("find . -name '*.pyo' -exec rm -f {} +")
run_cmd("find . -name '*~' -exec rm -f {} +")
run_cmd("find . -name '._*' -exec rm -f {} +")
@task('clean')
def clean_env():
run_cmd('rm -r ./env && mkdir env && touch env/.keep')
def run_cmd(cmd):
"Run a system command verbosely."
print('Running \'' + cmd + '\'...')
run(cmd)
print('Done')