mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +01:00
mach clean-snapshots: better no-op output
This commit is contained in:
parent
b337b0e5e0
commit
3fdbb4bfbb
1 changed files with 5 additions and 2 deletions
|
@ -164,17 +164,20 @@ class MachCommands(CommandBase):
|
||||||
cargo_current = self.cargo_build_id()
|
cargo_current = self.cargo_build_id()
|
||||||
print("Current Rust version: " + rust_current)
|
print("Current Rust version: " + rust_current)
|
||||||
print("Current Cargo version: " + cargo_current)
|
print("Current Cargo version: " + cargo_current)
|
||||||
action = "Removing " if force else "Would remove "
|
removing_anything = False
|
||||||
for current, base in [(rust_current, "rust"), (cargo_current, "cargo")]:
|
for current, base in [(rust_current, "rust"), (cargo_current, "cargo")]:
|
||||||
base = path.join(self.context.sharedir, base)
|
base = path.join(self.context.sharedir, base)
|
||||||
for name in os.listdir(base):
|
for name in os.listdir(base):
|
||||||
if name != current:
|
if name != current:
|
||||||
|
removing_anything = True
|
||||||
name = path.join(base, name)
|
name = path.join(base, name)
|
||||||
if force:
|
if force:
|
||||||
print("Removing " + name)
|
print("Removing " + name)
|
||||||
shutil.rmtree(name)
|
shutil.rmtree(name)
|
||||||
else:
|
else:
|
||||||
print("Would remove " + name)
|
print("Would remove " + name)
|
||||||
if not force:
|
if not removing_anything:
|
||||||
|
print("Nothing to remove.")
|
||||||
|
elif not force:
|
||||||
print("Nothing done. "
|
print("Nothing done. "
|
||||||
"Run `./mach clean-snapshots -f` to actually remove.")
|
"Run `./mach clean-snapshots -f` to actually remove.")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue