Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 130 lines (95 sloc) 2.697 kb
5db0009 Added pavement.py
Ask Solem authored
1 from paver.easy import *
2 from paver import doctools
3 from paver.setuputils import setup
4
5 options(
6 sphinx=Bunch(builddir=".build"),
7 )
8
9 def sphinx_builddir(options):
10 return path("docs") / options.sphinx.builddir / "html"
11
12
13 @task
14 def clean_docs(options):
15 sphinx_builddir(options).rmtree()
16
17
18 @task
19 @needs("clean_docs", "paver.doctools.html")
20 def html(options):
21 destdir = path("Documentation")
22 destdir.rmtree()
23 builtdocs = sphinx_builddir(options)
24 builtdocs.move(destdir)
25
26
27 @task
28 @needs("clean_docs", "paver.doctools.html")
29 def ghdocs(options):
30 builtdocs = sphinx_builddir(options)
31 sh("sphinx-to-github", cwd=builtdocs)
32 sh("git checkout gh-pages && \
33 cp -r %s/* . && \
34 git commit . -m 'Rendered documentation for Github Pages.' && \
35 git push origin gh-pages && \
36 git checkout master" % builtdocs)
37
38
39 @task
40 @needs("clean_docs", "paver.doctools.html")
41 def upload_pypi_docs(options):
42 builtdocs = path("docs") / options.builddir / "html"
43 sh("python setup.py upload_sphinx --upload-dir='%s'" % (builtdocs))
44
45
46 @task
47 @needs("upload_pypi_docs", "ghdocs")
48 def upload_docs(options):
49 pass
50
51
52 @task
53 def flakes(options):
54 sh("find redish -name '*.py' | xargs pyflakes")
55
56
57 @task
58 def clean_readme(options):
59 path("README").unlink()
60 path("README.rst").unlink()
61
62
63 @task
64 @needs("clean_readme")
65 def readme(options):
66 sh("python contrib/release/sphinx-to-rst.py docs/templates/readme.txt \
67 > README.rst")
68 sh("ln -sf README.rst README")
69
70
71 @task
72 def bump(options):
73 sh("bump -c redish")
74
75
76 @task
77 @cmdopts([
78 ("coverage", "c", "Enable coverage"),
79 ("quick", "q", "Quick test"),
80 ("verbose", "V", "Make more noise"),
81 ])
82 def test(options):
83 cmd = "python manage.py test"
84 if getattr(options, "coverage", False):
85 cmd += " --coverage"
86 if getattr(options, "quick", False):
87 cmd = "env QUICKTEST=1 %s" % cmd
88 if getattr(options, "verbose", False):
89 cmd += " --verbosity=2"
90 sh(cmd, cwd="tests")
91
92
93 @task
94 @cmdopts([
95 ("noerror", "E", "Ignore errors"),
96 ])
97 def pep8(options):
98 noerror = getattr(options, "noerror", False)
99 return sh("""find . -name "*.py" | xargs pep8 | perl -nle'\
100 print; $a=1 if $_}{exit($a)'""", ignore_error=noerror)
101
102
103 @task
104 def removepyc(options):
105 sh("find . -name '*.pyc' | xargs rm")
106
107
108 @task
109 @needs("removepyc")
110 def gitclean(options):
111 sh("git clean -xdn")
112
113
114 @task
115 @needs("removepyc")
116 def gitcleanforce(options):
117 sh("git clean -xdf")
118
119
120 @task
121 @needs("pep8", "test", "gitclean")
122 def releaseok(options):
123 pass
124
125
126 @task
127 @needs("releaseok", "removepyc", "upload_docs")
128 def release(options):
129 pass
Something went wrong with that request. Please try again.