Teach build/symlink.py --force to delete directories.

Otherwise os.remove just fails saying it can't delete a directory.

R=dpranke@chromium.org

Review URL: https://codereview.chromium.org/1222573002

Cr-Original-Commit-Position: refs/heads/master@{#337083}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: add100b7cd19ae6caad54ac6c6ed9766b7f1f70b
This commit is contained in:
eseidel 2015-07-01 12:09:40 -07:00 коммит произвёл Commit bot
Родитель bb901d00ee
Коммит b78630700f
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -9,6 +9,7 @@
import errno
import optparse
import os.path
import shutil
import sys
@ -29,7 +30,10 @@ def Main(argv):
os.symlink(s, t)
except OSError, e:
if e.errno == errno.EEXIST and options.force:
os.remove(t)
if os.path.isdir(t):
shutil.rmtree(t, ignore_errors=True)
else:
os.remove(t)
os.symlink(s, t)
else:
raise