1
2 """ Paver Cleanup Tasks.
3
4 Copyright (c) 2011 The PyroScope Project <pyroscope.project@gmail.com>
5 """
6
7
8
9
10
11
12
13
14
15
16
17
18
19 from __future__ import with_statement
20
21 import os
22 import glob
23
24 from paver import easy
25
26
27 @easy.task
28 @easy.cmdopts([
29 ('src-dir=', 's', 'directory where the source lives'),
30 ])
31 @easy.needs("distutils.command.clean")
32 -def clean():
33 "take out the trash"
34 src_dir = easy.options.setdefault("docs", {}).get('src_dir', None)
35 if src_dir is None:
36 src_dir = 'src' if easy.path('src').exists() else '.'
37
38 with easy.pushd(src_dir):
39 for pkg in set(easy.options.setup.packages) | set(("tests",)):
40 for filename in glob.glob(pkg.replace('.', os.sep) + "/*.py[oc~]"):
41 easy.path(filename).remove()
42
43
44 @easy.task
45 @easy.needs("clean")
46 -def dist_clean():
47 "clean up, including dist directory"
48 easy.path("dist").rmtree()
49