diff options
author | Greg Ward <gward@python.net> | 2000-09-12 00:07:49 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2000-09-12 00:07:49 (GMT) |
commit | 7ac743bd72d1550d8f8df4787467f386a14bffa9 (patch) | |
tree | d26130123fdc8f1298f1deb512be469f3543291a /Lib/distutils | |
parent | 4b9f4938302fa54cc486176bf3877b2a4ff0401b (diff) | |
download | cpython-7ac743bd72d1550d8f8df4787467f386a14bffa9.zip cpython-7ac743bd72d1550d8f8df4787467f386a14bffa9.tar.gz cpython-7ac743bd72d1550d8f8df4787467f386a14bffa9.tar.bz2 |
Bastian Kleineidam: fix so it cleans up the temporary script-building
directory too. Also generally cleaned up the code.
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/command/clean.py | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/Lib/distutils/command/clean.py b/Lib/distutils/command/clean.py index 1d8c7b2..2f3597f 100644 --- a/Lib/distutils/command/clean.py +++ b/Lib/distutils/command/clean.py @@ -20,6 +20,8 @@ class clean (Command): "build directory for all modules (default: 'build.build-lib')"), ('build-temp=', 't', "temporary build directory (default: 'build.build-temp')"), + ('build-scripts=', None, + "build directory for scripts (default: 'build.build-scripts')"), ('bdist-base=', None, "temporary directory for built distributions"), ('all', 'a', @@ -30,6 +32,7 @@ class clean (Command): self.build_base = None self.build_lib = None self.build_temp = None + self.build_scripts = None self.bdist_base = None self.all = None @@ -37,6 +40,7 @@ class clean (Command): self.set_undefined_options('build', ('build_base', 'build_base'), ('build_lib', 'build_lib'), + ('build_scripts', 'build_scripts'), ('build_temp', 'build_temp')) self.set_undefined_options('bdist', ('bdist_base', 'bdist_base')) @@ -50,27 +54,16 @@ class clean (Command): self.warn ("'%s' does not exist -- can't clean it" % self.build_temp) - - - if self.all: - # remove the module build directory (unless already gone) - if os.path.exists (self.build_lib): - remove_tree (self.build_lib, self.verbose, self.dry_run) - else: - self.warn ("'%s' does not exist -- can't clean it" % - self.build_lib) - - # remove the temporary directory used for creating built - # distributions (default "build/bdist") -- eg. type of - # built distribution will have its own subdirectory under - # "build/bdist", but they'll be taken care of by - # 'remove_tree()'. - if os.path.exists (self.bdist_base): - remove_tree (self.bdist_base, self.verbose, self.dry_run) - else: - self.warn ("'%s' does not exist -- can't clean it" % - self.bdist_base) + # remove build directories + for directory in (self.build_lib, + self.bdist_base, + self.build_scripts): + if os.path.exists (directory): + remove_tree (directory, self.verbose, self.dry_run) + else: + self.warn ("'%s' does not exist -- can't clean it" % + directory) # just for the heck of it, try to remove the base build directory: # we might have emptied it right now, but if not we don't care |