-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfabfile.py
72 lines (60 loc) · 2.7 KB
/
fabfile.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
from fabric.api import lcd, local, settings, task, puts, hide
from fabric.colors import green
import os
ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
def info(text):
puts(green(text))
@task
def polish():
with lcd(ROOT_DIR):
with settings(hide('running'), warn_only=True):
# Remove compiled python classes
info('Removing compiled python classes...')
local('pyclean ./r5d4 ./tests ./scripts fabfile.py run.py')
local('find ./r5d4 ./tests ./scripts fabfile.py run.py '
'-name "*.py[co]" -print0 | xargs -0 rm -f')
# Fix file permissions
info('Fixing file permissions...')
local('find . '
'-path ./.git -prune -o '
'-path ./venv -prune -o '
'\( -name "analytics.py" -o '
'-name "analytics_manager.py" -o '
'-name "analytics_worker.py" -o '
'-name "run.py" -o '
'-wholename "./scripts/add_keys.py" -o '
'-wholename "./tests/publish.py" -o '
'-wholename "./tests/run_tests.py" \) '
'-exec chmod 0755 {} \\; -o '
'-type d -exec chmod 0755 {} \\; -o '
'-type f -exec chmod 0644 {} \\;')
# Run coding standards check
info('Running coding standards check...')
local('pep8 ./r5d4 ./tests ./scripts fabfile.py run.py')
# Run static code analyzer
info('Running static code analyzer...')
local('pyflakes ./r5d4 ./tests ./scripts fabfile.py run.py')
# Find merge conflict leftovers
info('Finding merge conflict leftovers...')
local('! find . '
'-path ./.git -prune -o '
'-path ./venv -prune -o '
'-wholename "./fabfile.py" -o '
'-type d -o '
'-print0 | '
'xargs -0 grep -Pn "<<<<|====|>>>>"')
# Check for debug print statements
info('Checking for debug print statements...')
local('! find . -type f '
'-path ./.git -prune -o '
'-path ./venv -prune -o '
'-wholename "./fabfile.py" -o '
'-name "*.py" -print0 | '
'xargs -0 grep -Pn \'(?<![Bb]lue)print\'')
# Run Tests
info('Running tests...')
local('PYTHONPATH="%s" ./tests/run_tests.py' % ROOT_DIR)
# Remove compiled python classes
info('Removing compiled python classes...')
local('pyclean .')
local('find . -name "*.py[co]" -print0 | xargs -0 rm -f')