-
Notifications
You must be signed in to change notification settings - Fork 10
/
pavement.py
106 lines (76 loc) · 2.06 KB
/
pavement.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
from paver.easy import *
from paver import doctools
from paver.setuputils import setup
DIST = "djangofeeds"
options(
sphinx=Bunch(builddir=".build"),
)
def sphinx_builddir(options):
return path("docs") / options.sphinx.builddir / "html"
@task
def clean_docs(options):
sphinx_builddir(options).rmtree()
@task
@needs("clean_docs", "paver.doctools.html")
def html(options):
destdir = path("Documentation")
destdir.rmtree()
builtdocs = sphinx_builddir(options)
builtdocs.move(destdir)
@task
@needs("clean_docs", "paver.doctools.html")
def upload_pypi_docs(options):
builtdocs = path("docs") / options.builddir / "html"
sh("python setup.py upload_sphinx --upload-dir='%s'" % (builtdocs))
@task
@needs("upload_pypi_docs", "ghdocs")
def upload_docs(options):
pass
@task
def flakes(options):
sh("find %s -name '*.py' | xargs pyflakes" % (DIST, ))
@task
def bump(options):
sh("bump -c %s" % (DIST, ))
@task
@cmdopts([
("coverage", "c", "Enable coverage"),
("quick", "q", "Quick test"),
("verbose", "V", "Make more noise"),
])
def test(options):
cmd = "python manage.py test"
if getattr(options, "coverage", False):
cmd += " --with-coverage3 --cover3-html"
if getattr(options, "quick", False):
cmd = "env QUICKTEST=1"
if getattr(options, "verbose", False):
cmd += " --verbosity=2"
sh(cmd, cwd="tests")
@task
@cmdopts([
("noerror", "E", "Ignore errors"),
])
def pep8(options):
noerror = getattr(options, "noerror", False)
return sh("""find djangofeeds -name "*.py" | xargs pep8 | perl -nle'\
print; $a=1 if $_}{exit($a)'""", ignore_error=noerror)
@task
def removepyc(options):
sh("find . -name '*.pyc' | xargs rm")
@task
@needs("removepyc")
def gitclean(options):
sh("git clean -xdn")
@task
@needs("removepyc")
def gitcleanforce(options):
sh("git clean -xdf")
@task
@needs("pep8", "autodoc", "verifyindex", "test", "gitclean")
def releaseok(options):
pass
@task
@needs("releaseok", "removepyc", "upload_docs")
def release(options):
pass