Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3665)

Unified Diff: build/clobber.py

Issue 1812673003: Use rmdir /s/q instead of flaky shutil.rmtree on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore return Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/clobber.py
diff --git a/build/clobber.py b/build/clobber.py
index 785011a171d836f9cbf8dc0ddd101a015b3335de..264b390211e887107966c47d248cf7bfa6f5ea9a 100755
--- a/build/clobber.py
+++ b/build/clobber.py
@@ -7,7 +7,9 @@
import argparse
import os
+import platform
import shutil
+import subprocess
import sys
@@ -35,11 +37,20 @@ def extract_gn_build_commands(build_ninja_file):
return result
+def delete_dir(build_dir):
+ # For unknown reasons (anti-virus?) rmtree of Chromium build directories
+ # often fails on Windows.
+ if platform.system() == 'Windows':
scottmg 2016/03/18 00:40:37 I think "if sys.platform.startswith('win')" is mor
brucedawson 2016/03/18 20:55:50 Ah - yes. That's what I was looking for. Done (inc
+ subprocess.call(['rmdir', '/s', '/q', build_dir], shell=True)
scottmg 2016/03/18 00:40:37 .call -> .check_call
brucedawson 2016/03/18 20:55:50 Done.
+ else:
+ shutil.rmtree(build_dir)
+
+
def delete_build_dir(build_dir):
# GN writes a build.ninja.d file. Note that not all GN builds have args.gn.
build_ninja_d_file = os.path.join(build_dir, 'build.ninja.d')
if not os.path.exists(build_ninja_d_file):
- shutil.rmtree(build_dir)
+ delete_dir(build_dir)
return
# GN builds aren't automatically regenerated when you sync. To avoid
@@ -56,7 +67,7 @@ def delete_build_dir(build_dir):
except IOError:
args_contents = ''
- shutil.rmtree(build_dir)
+ delete_dir(build_dir)
# Put back the args file (if any).
os.mkdir(build_dir)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698