-
Notifications
You must be signed in to change notification settings - Fork 0
/
pavement.py
81 lines (65 loc) · 2.09 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
""" Pavement build main file. Use paver (pip package) to run. """
# Based upon: https://github.com/jenisys/behave.example/blob/master/pavement.py
from paver.easy import * # pylint: disable=W0401,W0614
import paver.doctools
from paver.setuputils import setup
options(
setup=dict(
name="Code Compare",
version="0.01",
description="Compare students submissions",
author="Matheus Gaudencio do Rego",
author_email="matheusgr@gmail.com",
install_requires=[],
# test_suite='nose.collector',
packages=['codecompare'],
url="http://www.splab.ufcg.edu.br/",
),
sphinx=Bunch(
builddir="build",
sourcedir="source"
),
)
@task
def init():
docs_final = path('docs') / 'final'
if docs_final.exists():
docs_final.rmtree()
path('coverage').rmtree()
path('coverage').mkdir()
docs_final.mkdir()
@task
def removepyc():
""" Removed created pyc files. """
for pyc in path.walkfiles(path('.'), '*.pyc'):
pyc.remove()
@task
def tests():
""" Test codecompare using tests found at tests dir. """
sh("nosetests --with-coverage --cover-package=codecompare --cover-inclusive --cover-html --cover-html-dir=coverage")
@task
@needs(["removepyc", "paver.doctools.doc_clean"])
def clean():
""" Overall clean task. """
docs_final = path('docs') / 'final'
if docs_final.exists():
docs_final.rmtree()
@task
@cmdopts([("noerror", "E", "Ignore errors"), ])
def pep8(pep_options):
""" Execute pep8 conformance test. """
noerror = getattr(pep_options, "noerror", False)
return sh("""find . -name "*.py" | xargs pep8 | perl -nle'\
print; $a=1 if $_}{exit($a)'""", ignore_error=noerror)
@task
@needs(['html', "distutils.command.sdist"])
def sdist():
"""Generate docs and source distribution."""
pass
@task
@needs(['init', 'paver.doctools.html'])
def html():
"""Build Paver's documentation and install it into paver/docs"""
builtdocs = path('docs') / options.sphinx.builddir / "html"
destdir = path("docs") / "final"
builtdocs.move(destdir)