@@ -175,25 +175,24 @@ def all_host_triples(platform: str) -> list[str]:
175175
176176def clean (context : argparse .Namespace , target : str | None = None ) -> None :
177177 """The implementation of the "clean" command."""
178+ if target is None :
179+ target = context .host
180+
178181 # If we're explicitly targeting the build, there's no platform or
179182 # distribution artefacts. If we're cleaning tests, we keep all built
180183 # artefacts. Otherwise, the built artefacts must be dirty, so we remove
181184 # them.
182- if target is None :
183- target = context .host
184-
185- paths = []
185+ if target not in { "build" , "test" } :
186+ paths = [ "dist" , context .platform ] + list ( HOSTS [ context . platform ])
187+ else :
188+ paths = []
186189
187190 if target in {"all" , "build" }:
188191 paths .append ("build" )
189192
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" }:
193+ if target in {"all" , "hosts" }:
194+ paths .extend (all_host_triples (context .platform ))
195+ elif target not in {"build" , "test" , "package" }:
197196 paths .append (target )
198197
199198 if target in {"all" , "hosts" , "test" }:
0 commit comments