Package pyrobase :: Package paver :: Module housekeeping
[hide private]
[frames] | no frames]

Source Code for Module pyrobase.paver.housekeeping

 1  # -*- coding: utf-8 -*- 
 2  """ Paver Cleanup Tasks. 
 3   
 4      Copyright (c) 2011 The PyroScope Project <pyroscope.project@gmail.com> 
 5  """ 
 6  # This program is free software; you can redistribute it and/or modify 
 7  # it under the terms of the GNU General Public License as published by 
 8  # the Free Software Foundation; either version 2 of the License, or 
 9  # (at your option) any later version. 
10  # 
11  # This program is distributed in the hope that it will be useful, 
12  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
13  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
14  # GNU General Public License for more details. 
15  # 
16  # You should have received a copy of the GNU General Public License along 
17  # with this program; if not, write to the Free Software Foundation, Inc., 
18  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
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