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

Unified Diff: build/toolchain/mac/copy_bundle_data.py

Issue 2075463002: [Mac/iOS/GN] Use rsync in copy_bundle_data instead of shutil.copytree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/toolchain/mac/copy_bundle_data.py
diff --git a/build/toolchain/mac/copy_bundle_data.py b/build/toolchain/mac/copy_bundle_data.py
index 976591c08ee309a1df86d71d3bd6ce66d3865edc..1ca72d067e662008ea8186ad40ac06f1eab4820b 100644
--- a/build/toolchain/mac/copy_bundle_data.py
+++ b/build/toolchain/mac/copy_bundle_data.py
@@ -3,9 +3,11 @@
# 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'):
@@ -64,25 +66,24 @@ def copy_file(source, dest):
source: string, path to the source file
dest: string, path to the destination file
"""
- 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
+ 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.exists(dest):
- os.unlink(dest)
_, extension = os.path.splitext(source)
if extension == '.strings':
copy_strings_file(source, dest)
return
- shutil.copy(source, dest)
+ subprocess.check_call(
+ ['rsync', '--recursive', '--perms', '--links', source, dest])
Dirk Pranke 2016/06/15 22:11:40 I'm not sure if this'll do the right thing. If yo
Robert Sesek 2016/06/15 22:31:16 Good catch. Will strip the trailing slash(es) on t
def main():
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698