Don't clobber symlinks to build directories

Background: in order to use multiple build directories without the
cognitive or scripting overhead of figuring out which one is currently
in use, I keep a symlink "out/cur" pointing to the current one.

When the clobber script runs, it detects that out/cur is a build
directory (because out/cur/args.gn exists) but shutil.rmtree() fails
when applied to a symlink. This change skips the clobber when a link is
detected and leaves out/cur pointing to the real build dir. There's no
need to remove the symlink, since the original has been clobbered.

Review-Url: https://codereview.chromium.org/2642833002
Cr-Original-Commit-Position: refs/heads/master@{#444777}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 29acddfbe7b3c92cd85d99e416f920849d011ec1
This commit is contained in:
sfiera 2017-01-19 09:42:58 -08:00 коммит произвёл Commit bot
Родитель 1b6ff4f00b
Коммит f915284cf1
1 изменённых файлов: 2 добавлений и 0 удалений

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

@ -37,6 +37,8 @@ def extract_gn_build_commands(build_ninja_file):
def delete_dir(build_dir):
if os.path.islink(build_dir):
return
# For unknown reasons (anti-virus?) rmtree of Chromium build directories
# often fails on Windows.
if sys.platform.startswith('win'):