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) |