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

Unified Diff: base/allocator/prep_libc.py

Issue 10388215: replace prep_libc.sh with prep_libc.py, and quiet the output (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « base/allocator/allocator.gyp ('k') | base/allocator/prep_libc.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/allocator/prep_libc.py
diff --git a/base/allocator/prep_libc.py b/base/allocator/prep_libc.py
new file mode 100644
index 0000000000000000000000000000000000000000..9b20617db69108384df2d6cbab9f55f2d8c9e139
--- /dev/null
+++ b/base/allocator/prep_libc.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# This script takes libcmt.lib for VS2005/08/10 and removes the allocation
M-A Ruel 2012/05/30 12:55:11 This should be a docstring.
+# related functions from it.
+#
+# Usage: prep_libc.py <VCInstallDir> <OutputDir>
+#
+# VCInstallDir is the path where VC is installed, something like:
+# C:\Program Files\Microsoft Visual Studio 8\VC\
+#
+# OutputDir is the directory where the modified libcmt file should be stored.
+
+import os
+import shutil
+import subprocess
+import sys
+
M-A Ruel 2012/05/30 12:55:11 The rest of the code base is formatted with 2 vert
+def run(command, filter=None):
+ """Run |command|, removing any lines that match |filter|. The filter is
+ to remove the echoing of input filename that 'lib' does."""
+ popen = subprocess.Popen(
+ command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ out, _ = popen.communicate()
+ for line in out.splitlines():
+ if filter and line.strip() != filter:
+ print line
+ return popen.returncode
+
+def main():
+ vs_install_dir = sys.argv[1]
+ outdir = sys.argv[2]
+ output_lib = os.path.join(outdir, 'libcmt.lib')
+ shutil.copyfile(os.path.join(vs_install_dir, 'libcmt.lib'), output_lib)
+ shutil.copyfile(os.path.join(vs_install_dir, 'libcmt.pdb'),
+ os.path.join(outdir, 'libcmt.pdb'))
+ vspaths = [
+ 'build\\intel\\mt_obj\\',
Evan Martin 2012/05/23 17:44:15 perhaps more readable as r'build\intel\mt_obj' '
M-A Ruel 2012/05/30 12:55:11 I personally disagree, either a string all r'' or
+ 'f:\\dd\\vctools\\crt_bld\\SELF_X86\\crt\\src\\build\\INTEL\\mt_obj\\'
+ ]
+ objfiles = ['malloc', 'free', 'realloc', 'new', 'delete', 'new2', 'delete2',
+ 'align', 'msize', 'heapinit', 'expand', 'heapchk', 'heapwalk',
+ 'heapmin', 'sbheap', 'calloc', 'recalloc', 'calloc_impl',
+ 'new_mode', 'newopnt']
+ for obj in objfiles:
+ for vspath in vspaths:
+ cmd = ('lib /nologo /ignore:4006,4014,4221 /remove:%s%s.obj %s' %
M-A Ruel 2012/05/30 12:55:11 Please use a list, not a string.
+ (vspath, obj, output_lib))
+ run(cmd, obj + '.obj')
M-A Ruel 2012/05/30 12:55:11 you shouldn't discard the return code. If one of t
+
+if __name__ == "__main__":
+ sys.exit(main())
« no previous file with comments | « base/allocator/allocator.gyp ('k') | base/allocator/prep_libc.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698