@@ -173,23 +173,27 @@ def all_host_triples(platform: str) -> list[str]:
173173 return triples
174174
175175
176- def clean (context : argparse .Namespace , target : str = "all" ) -> None :
176+ def clean (context : argparse .Namespace , target : str | None = None ) -> None :
177177 """The implementation of the "clean" command."""
178178 # If we're explicitly targeting the build, there's no platform or
179179 # distribution artefacts. If we're cleaning tests, we keep all built
180180 # artefacts. Otherwise, the built artefacts must be dirty, so we remove
181181 # them.
182- if target not in { "build" , "test" } :
183- paths = [ "dist" , context .platform ] + list ( HOSTS [ context . platform ])
184- else :
185- paths = []
182+ if target is None :
183+ target = context .host
184+
185+ paths = []
186186
187187 if target in {"all" , "build" }:
188188 paths .append ("build" )
189189
190- if target in {"all" , "hosts" }:
191- paths .extend (all_host_triples (context .platform ))
192- elif target not in {"build" , "test" , "package" }:
190+ if target in {"all" , "hosts" , "package" }:
191+ paths .append ("dist" )
192+ paths .extend (list (HOSTS [context .platform ]))
193+ paths .append (context .platform )
194+ if target != "package" :
195+ paths .extend (all_host_triples (context .platform ))
196+ elif target not in {"build" , "test" }:
193197 paths .append (target )
194198
195199 if target in {"all" , "hosts" , "test" }:
0 commit comments