blob: 9785de9938708c887c133dc06c20944224af2825 [file] [log] [blame]
Greg Ward06537a52000-03-18 15:37:26 +00001"""distutils.command.clean
2
3Implements the Distutils 'clean' command."""
4
5# contributed by Bastian Kleineidam <calvin@cs.uni-sb.de>, added 2000-03-18
6
7__revision__ = "$Id$"
8
9import os
10from distutils.core import Command
11from distutils.util import remove_tree
12
13class clean (Command):
14
15 description = "clean files we built"
16 user_options = [
17 ('build-base=', 'b', "base directory for build library"),
18 ('build-lib=', None,
19 "build directory for all distribution (defaults to either " +
20 "build-purelib or build-platlib"),
21 ('build-temp=', 't', "temporary build directory"),
22 ('all', 'a',
23 "remove all build output, not just temporary by-products")
24 ]
25
26 def initialize_options(self):
27 self.build_base = None
28 self.build_lib = None
29 self.build_temp = None
30 self.all = None
31
32 def finalize_options(self):
33 self.set_undefined_options('build',
34 ('build_base', 'build_base'),
35 ('build_lib', 'build_lib'),
36 ('build_temp', 'build_temp'))
37
38 def run(self):
39 # remove the build/temp.<plat> directory
40 remove_tree (self.build_temp, self.verbose, self.dry_run)
41
42 if self.all:
43 # remove the build/lib resp. build/platlib directory
44 remove_tree (self.build_lib, self.verbose, self.dry_run)