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

Unified Diff: build_apprtc_collider.py

Issue 1566963004: Use cleanup with retry on Windows for all scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/webrtc/webrtc.DEPS@master
Patch Set: Created 4 years, 11 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 | « build_apprtc_appengine_app.py ('k') | copy_apprtc.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build_apprtc_collider.py
diff --git a/build_apprtc_collider.py b/build_apprtc_collider.py
index c9873a73016a9bc39fda63f4bed4b0707eef0fd6..f9ce9aa2f646c515fd796d61898aa2f675672eea 100755
--- a/build_apprtc_collider.py
+++ b/build_apprtc_collider.py
@@ -13,52 +13,14 @@ import os
import shutil
import subprocess
import sys
-import time
import utils
-# Code partially copied from
-# https://cs.chromium.org#chromium/build/scripts/common/chromium_utils.py
-def RemoveDirectory(*path):
- """Recursively removes a directory, even if it's marked read-only.
-
- Remove the directory located at *path, if it exists.
-
- shutil.rmtree() doesn't work on Windows if any of the files or directories
- are read-only, which svn repositories and some .svn files are. We need to
- be able to force the files to be writable (i.e., deletable) as we traverse
- the tree.
-
- Even with all this, Windows still sometimes fails to delete a file, citing
- a permission error (maybe something to do with antivirus scans or disk
- indexing). The best suggestion any of the user forums had was to wait a
- bit and try again, so we do that too. It's hand-waving, but sometimes it
- works. :/
- """
- file_path = os.path.join(*path)
- if not os.path.exists(file_path):
- return
-
- if sys.platform == 'win32':
- # Give up and use cmd.exe's rd command.
- file_path = os.path.normcase(file_path)
- for _ in xrange(3):
- print 'RemoveDirectory running %s' % (' '.join(
- ['cmd.exe', '/c', 'rd', '/q', '/s', file_path]))
- if not subprocess.call(['cmd.exe', '/c', 'rd', '/q', '/s', file_path]):
- break
- print ' Failed'
- time.sleep(3)
- return
- else:
- shutil.rmtree(file_path, ignore_errors=True)
-
-
def main():
apprtc_dir = os.path.join('apprtc', 'src')
golang_workspace = os.path.join('src', 'out', 'go-workspace')
- RemoveDirectory(golang_workspace)
+ utils.RemoveDirectory(golang_workspace)
golang_workspace_src = os.path.join(golang_workspace, 'src')
« no previous file with comments | « build_apprtc_appengine_app.py ('k') | copy_apprtc.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698