Attempt to fix update_node.py wrt read-only files on Windows.

TBR=machenbach@chromium.org

Change-Id: I5b82f56e9b9d894455500de693fe6ac6de5205ae
Reviewed-on: https://chromium-review.googlesource.com/758764
Commit-Queue: Yang Guo <yangguo@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49259}
This commit is contained in:
Yang Guo 2017-11-09 10:13:52 +01:00 committed by Commit Bot
parent b9c9932202
commit 8ba40216db

View File

@ -28,6 +28,7 @@ import os
import shutil
import subprocess
import sys
import stat
TARGET_SUBDIR = os.path.join("deps", "v8")
@ -61,7 +62,11 @@ def UninitGit(path):
target = os.path.join(path, ".git")
if os.path.isdir(target):
print ">> Cleaning up %s" % path
shutil.rmtree(target)
def OnRmError(func, path, exec_info):
# This might happen on Windows
os.chmod(path, stat.S_IWRITE)
os.unlink(path)
shutil.rmtree(target, onerror=OnRmError)
def CommitPatch(options):
"""Makes a dummy commit for the changes in the index.