MCPcopy Index your code
hub / github.com/python/cpython / clean

Function clean

Platforms/Apple/__main__.py:176–205  ·  view source on GitHub ↗

The implementation of the "clean" command.

(context: argparse.Namespace, target: str | None = None)

Source from the content-addressed store, hash-verified

174
175
176def clean(context: argparse.Namespace, target: str | None = None) -> None:
177 """The implementation of the "clean" command."""
178 if target is None:
179 target = context.host
180
181 # If we're explicitly targeting the build, there's no platform or
182 # distribution artefacts. If we're cleaning tests, we keep all built
183 # artefacts. Otherwise, the built artefacts must be dirty, so we remove
184 # them.
185 if target not in {"build", "test"}:
186 paths = ["dist", context.platform] + list(HOSTS[context.platform])
187 else:
188 paths = []
189
190 if target in {"all", "build"}:
191 paths.append("build")
192
193 if target in {"all", "hosts"}:
194 paths.extend(all_host_triples(context.platform))
195 elif target not in {"build", "test", "package"}:
196 paths.append(target)
197
198 if target in {"all", "hosts", "test"}:
199 paths.extend([
200 path.name
201 for path in CROSS_BUILD_DIR.glob(f"{context.platform}-testbed.*")
202 ])
203
204 for path in paths:
205 delete_path(path)
206
207
208def build_python_path() -> Path:

Callers 6

configure_build_pythonFunction · 0.70
configure_host_pythonFunction · 0.70
packageFunction · 0.70
buildFunction · 0.70
testFunction · 0.70
ciFunction · 0.70

Calls 6

listClass · 0.85
all_host_triplesFunction · 0.85
delete_pathFunction · 0.85
appendMethod · 0.45
extendMethod · 0.45
globMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…