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

Unified Diff: build/android/gyp/copy_ex.py

Issue 1141793003: Update from https://crrev.com/329939 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 | « build/android/gyp/apk_obfuscate.py ('k') | build/android/gyp/dex.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/copy_ex.py
diff --git a/build/android/gyp/copy_ex.py b/build/android/gyp/copy_ex.py
index eee3d191747c074545ebc24f5a37cfc0ac01e6ec..a474e770654f8eebfa13392e9086b4ed96b7a996 100755
--- a/build/android/gyp/copy_ex.py
+++ b/build/android/gyp/copy_ex.py
@@ -7,12 +7,23 @@
"""Copies files to a directory."""
import optparse
+import os
import shutil
import sys
from util import build_utils
+def _get_all_files(base):
+ """Returns a list of all the files in |base|. Each entry is relative to the
+ last path entry of |base|."""
+ result = []
+ dirname = os.path.dirname(base)
+ for root, _, files in os.walk(base):
+ result.extend([os.path.join(root[len(dirname):], f) for f in files])
+ return result
+
+
def main(args):
args = build_utils.ExpandFileArgs(args)
@@ -38,13 +49,24 @@ def main(args):
for file_arg in options.files:
files += build_utils.ParseGypList(file_arg)
+ deps = []
+
for f in files:
- shutil.copy(f, options.dest)
+ if os.path.isdir(f):
+ if not options.clear:
+ print ('To avoid stale files you must use --clear when copying '
+ 'directories')
+ sys.exit(-1)
+ shutil.copytree(f, os.path.join(options.dest, os.path.basename(f)))
+ deps.extend(_get_all_files(f))
+ else:
+ shutil.copy(f, options.dest)
+ deps.append(f)
if options.depfile:
build_utils.WriteDepfile(
options.depfile,
- files + build_utils.GetPythonDependencies())
+ deps + build_utils.GetPythonDependencies())
if options.stamp:
build_utils.Touch(options.stamp)
« no previous file with comments | « build/android/gyp/apk_obfuscate.py ('k') | build/android/gyp/dex.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698