Revert of [Mac/iOS/GN] Use rsync in copy_bundle_data instead of shutil.copytree. (patchset #2 id:20001 of https://codereview.chromium.org/2075463002/ )

Reason for revert:
Broke both Mac GN builders; tests are failing with errors such as:

AcceleratorsCocoaBrowserTest.MainMenuAcceleratorsInMapping (run #1):
[ RUN      ] AcceleratorsCocoaBrowserTest.MainMenuAcceleratorsInMapping
[1361:515:0615/193339:210535270587:FATAL:crashpad_client_mac.cc(411)] execvp /b/swarm_slave/work/isolated/isolated_runTnrdHD/out/Release/Chromium.app/Contents/Versions/53.0.2769.0/Chromium Framework.framework/Helpers/crashpad_handler: No such file or directory

Original issue's description:
> [Mac/iOS/GN] Use rsync in copy_bundle_data instead of shutil.copytree.
>
> As the TODO this fixes states, copytree preserves mtimes. This can cause
> overbuild when building bundled products. Switch to using rsync to have more
> control over copy parameters.
>
> BUG=297668
> R=dpranke@chromium.org
>
> Committed: https://crrev.com/0cc137a639e9eb687b0fbde47983d672bcc8ef9f
> Cr-Commit-Position: refs/heads/master@{#400047}

TBR=dpranke@chromium.org,rsesek@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=297668

Review-Url: https://codereview.chromium.org/2074523003
Cr-Original-Commit-Position: refs/heads/master@{#400081}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: e127bb46966c5d7eec116a9612502e1cd0ea20cf
This commit is contained in:
dmazzoni 2016-06-15 20:24:42 -07:00 коммит произвёл Commit bot
Родитель 76e9bd0241
Коммит f71f7e3b27
1 изменённых файлов: 13 добавлений и 17 удалений

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

@ -3,11 +3,9 @@
# found in the LICENSE file.
import argparse
import errno
import os
import shutil
import sys
import subprocess
def detect_encoding(data, default_encoding='UTF-8'):
@ -66,27 +64,25 @@ def copy_file(source, dest):
source: string, path to the source file
dest: string, path to the destination file
"""
try:
shutil.rmtree(dest)
except OSError as e:
if e.errno == errno.ENOENT:
pass
elif e.errno == errno.ENOTDIR:
os.unlink(dest)
else:
raise
if os.path.isdir(source):
if os.path.exists(dest):
shutil.rmtree(dest)
# Copy tree.
# TODO(thakis): This copies file attributes like mtime, while the
# single-file branch below doesn't. This should probably be changed to
# be consistent with the single-file branch.
shutil.copytree(source, dest, symlinks=True)
return
if os.path.exists(dest):
os.unlink(dest)
_, extension = os.path.splitext(source)
if extension == '.strings':
copy_strings_file(source, dest)
return
# Strip trailing slashes on the source so rsync copies the source as a
# directory.
source = source.rstrip('/')
subprocess.check_call(
['rsync', '--recursive', '--perms', '--links', source, dest])
shutil.copy(source, dest)
def main():