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

Unified Diff: scripts/common/chromium_utils.py

Issue 11379003: Add Windows ASAN bots. (Closed) Base URL: http://git.chromium.org/chromium/tools/build.git@neuter
Patch Set: Cleanup some unnecessary pieces Created 8 years, 1 month 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
Index: scripts/common/chromium_utils.py
diff --git a/scripts/common/chromium_utils.py b/scripts/common/chromium_utils.py
index a5fc2296f7add14cabec1eebac12dad3ef520b2b..b8799b2c3a4a0f1e8e8b787c9bfa26a78cc2e13f 100644
--- a/scripts/common/chromium_utils.py
+++ b/scripts/common/chromium_utils.py
@@ -475,7 +475,7 @@ def CopyFileToDir(src_path, dest_dir, dest_fn=None):
def MakeZip(output_dir, archive_name, file_list, file_relative_dir,
- raise_error=True, remove_archive_directory=True):
+ raise_error=True, remove_archive_directory=True, replacements=None):
"""Packs files into a new zip archive.
Files are first copied into a directory within the output_dir named for
@@ -499,6 +499,10 @@ def MakeZip(output_dir, archive_name, file_list, file_relative_dir,
the list is not found.
remove_archive_directory: Whether to remove the archive staging directory
before copying files over to it.
+ replacements: A list of fun(path) -> path functions. For each file
+ to add, transform the path with each function in replacements in order,
+ and read data from the resulting file instead. i.e. foo.exe could actually
+ contain data from foo.asan.exe.
Returns:
A tuple consisting of (archive_dir, zip_file_path), where archive_dir
@@ -527,6 +531,15 @@ def MakeZip(output_dir, archive_name, file_list, file_relative_dir,
# These paths are relative to the file_relative_dir. We need to copy
# them over maintaining the relative directories, where applicable.
src_path = os.path.join(file_relative_dir, needed_file)
+ new_src_path = src_path
+ for func in (replacements or []):
+ new_src_path = func(src_path)
+ if new_src_path is None:
+ print 'Skipping %s' % src_path
+ continue
+ if new_src_path != src_path:
+ print 'Replacing contents of %s with %s' % (src_path, new_src_path)
+ src_path = new_src_path
dirname, basename = os.path.split(needed_file)
try:
if os.path.isdir(src_path):
@@ -535,9 +548,9 @@ def MakeZip(output_dir, archive_name, file_list, file_relative_dir,
elif dirname != '' and basename != '':
dest_dir = os.path.join(archive_dir, dirname)
MaybeMakeDirectory(dest_dir)
- CopyFileToDir(src_path, dest_dir)
+ CopyFileToDir(src_path, dest_dir, basename)
else:
- CopyFileToDir(src_path, archive_dir)
+ CopyFileToDir(src_path, archive_dir, basename)
except PathNotFound:
if raise_error:
raise

Powered by Google App Engine
This is Rietveld 408576698