-
Notifications
You must be signed in to change notification settings - Fork 1
/
fabfile.py
65 lines (49 loc) · 1.58 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
"""
Fabric fabfile for Davies cave survey package.
Run `pip install fabric` to install, then `fab --list` to see available commands.
"""
from fabric.api import local, lcd, with_settings
def test():
"""Run project unit tests."""
local('python -m unittest discover -v -s tests')
unittest = test
@with_settings(warn_only=True)
def pep8():
"""Check source for PEP8 conformance."""
local('pep8 --max-line-length=120 davies')
def precommit():
"""Run pre-commit unit tests and lint checks."""
pep8()
local('pylint -f colorized --errors-only davies')
local('2to3 davies')
test()
def lint(fmt='colorized'):
"""Run verbose PyLint on source. Optionally specify fmt=html for HTML output."""
if fmt == 'html':
outfile = 'pylint_report.html'
local('pylint -f %s davies > %s || true' % (fmt, outfile))
local('open %s' % outfile)
else:
local('pylint -f %s davies || true' % fmt)
pylint = lint
def clean():
"""Clean up generated files."""
local('rm -rf dist')
local('rm -f pylint_report.html')
local('find . -name "*.pyc" | xargs rm')
with lcd('docs'):
local('make clean')
def release(version):
"""Perform git-flow release merging and PyPI upload."""
clean()
local('git checkout master')
local('git merge --no-ff dev')
local('git tag %s' % version)
local('python setup.py sdist upload')
def doc(fmt='html'):
"""Build Sphinx HTML documentation."""
with lcd('docs'):
local('make %s' % fmt)
if fmt == 'html':
local('open docs/_build/html/index.html')
docs = doc