forked from bogdan-kulynych/petlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pavement.py
67 lines (51 loc) · 1.76 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
import os.path
import os
import re
import fnmatch
from paver.tasks import task, cmdopts
from paver.easy import sh, needs, pushd
from paver.virtual import *
def tell(x):
print()
print(("-"*10)+ str(x) + ("-"*10))
print()
@task
def build(quiet=True):
""" Builds the petlib distribution, ready to be uploaded to pypi. """
tell("Build dist")
sh('python setup.py sdist', capture=quiet)
@task
def win(quiet=True):
""" Builds the petlib binary distribution for windows. """
tell("Build windows distribution")
sh('python setup.py build bdist_wininst', capture=quiet)
@task
def upload(quiet=False):
""" Uploads the latest distribution to pypi. """
lib = open(os.path.join("petlib", "__init__.py")).read()
v = re.findall("VERSION.*=.*['\"](.*)['\"]", lib)[0]
tell("upload dist %s" % v)
sh('git tag -a v%s -m "Distribution versio v%s"' % (v, v))
sh('python setup.py sdist upload', capture=quiet)
tell('Remember to upload tags using "git push --tags"')
@task
def lint(quiet=False):
""" Run the python linter on petlib with project specific options (see pylintrc petlib). """
tell("Run pylint on the library")
sh('pylint --rcfile=pylintrc petlib', capture=quiet)
@task
def make_docs(quiet=True):
""" Build the petlib documentation. """
tell("Making Docs")
with pushd('docs') as old_dir:
sh('make html', capture=quiet)
@task
def wc(quiet=False):
""" Count the petlib library and example code lines. """
tell("Counting code lines")
print("\nLibrary code:")
sh('wc -l petlib/*.py', capture=quiet)
print("\nExample code:")
sh('wc -l examples/*.py', capture=quiet)
print("\nAdministration code:")
sh('wc -l pavement.py setup.py docs/conf.py utils/ignoretest.py', capture=quiet)