]>
jfr.im git - dlqueue.git/blob - venv/lib/python3.11/site-packages/setuptools/_distutils/command/clean.py
1 """distutils.command.clean
3 Implements the Distutils 'clean' command."""
5 # contributed by Bastian Kleineidam <calvin@cs.uni-sb.de>, added 2000-03-18
8 from ..core
import Command
9 from ..dir_util
import remove_tree
10 from distutils
._log
import log
14 description
= "clean up temporary files from 'build' command"
16 ('build-base=', 'b', "base build directory (default: 'build.build-base')"),
20 "build directory for all modules (default: 'build.build-lib')",
22 ('build-temp=', 't', "temporary build directory (default: 'build.build-temp')"),
26 "build directory for scripts (default: 'build.build-scripts')",
28 ('bdist-base=', None, "temporary directory for built distributions"),
29 ('all', 'a', "remove all build output, not just temporary by-products"),
32 boolean_options
= ['all']
34 def initialize_options(self
):
35 self
.build_base
= None
37 self
.build_temp
= None
38 self
.build_scripts
= None
39 self
.bdist_base
= None
42 def finalize_options(self
):
43 self
.set_undefined_options(
45 ('build_base', 'build_base'),
46 ('build_lib', 'build_lib'),
47 ('build_scripts', 'build_scripts'),
48 ('build_temp', 'build_temp'),
50 self
.set_undefined_options('bdist', ('bdist_base', 'bdist_base'))
53 # remove the build/temp.<plat> directory (unless it's already
55 if os
.path
.exists(self
.build_temp
):
56 remove_tree(self
.build_temp
, dry_run
=self
.dry_run
)
58 log
.debug("'%s' does not exist -- can't clean it", self
.build_temp
)
61 # remove build directories
62 for directory
in (self
.build_lib
, self
.bdist_base
, self
.build_scripts
):
63 if os
.path
.exists(directory
):
64 remove_tree(directory
, dry_run
=self
.dry_run
)
66 log
.warning("'%s' does not exist -- can't clean it", directory
)
68 # just for the heck of it, try to remove the base build directory:
69 # we might have emptied it right now, but if not we don't care
72 os
.rmdir(self
.build_base
)
73 log
.info("removing '%s'", self
.build_base
)