mirror of https://github.com/python/cpython
Bastian Kleineidam: fix so it cleans up the temporary script-building
directory too. Also generally cleaned up the code.
This commit is contained in:
parent
4b9f493830
commit
7ac743bd72
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue