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

Unified Diff: base/allocator/prep_libc.py

Issue 1433093002: Roll buildtools 4a95614772..3ba3ca22ec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « base/allocator/BUILD.gn ('k') | build/win/message_compiler.py » ('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
index 079297b4629346601a1401e59f98f47e09578033..a88d3bd02573cbd7bc5271a4dc66d473871b26ed 100755
--- a/base/allocator/prep_libc.py
+++ b/base/allocator/prep_libc.py
@@ -7,24 +7,34 @@
# This script takes libcmt.lib for VS2013 and removes the allocation related
# functions from it.
#
-# Usage: prep_libc.py <VCLibDir> <OutputDir> <arch>
+# Usage: prep_libc.py <VCLibDir> <OutputDir> <arch> [<environment_file>]
#
# VCLibDir is the path where VC is installed, something like:
# C:\Program Files\Microsoft Visual Studio 8\VC\lib
+#
# OutputDir is the directory where the modified libcmt file should be stored.
# arch is one of: 'ia32', 'x86' or 'x64'. ia32 and x86 are synonyms.
+#
+# If the environment_file argument is set, the environment variables in the
+# given file will be used to execute the VC tools. This file is in the same
+# format as the environment block passed to CreateProcess.
import os
import shutil
import subprocess
import sys
-def run(command):
+def run(command, env_dict):
"""Run |command|. If any lines that match an error condition then
- terminate."""
+ terminate.
+
+ The env_dict, will be used for the environment. None can be used to get the
+ default environment."""
error = 'cannot find member object'
+ # Need shell=True to search the path in env_dict for the executable.
popen = subprocess.Popen(
- command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True,
+ env=env_dict)
out, _ = popen.communicate()
for line in out.splitlines():
print line
@@ -41,6 +51,13 @@ def main():
bindir = 'SELF_64_amd64'
objdir = 'amd64'
vs_install_dir = os.path.join(vs_install_dir, 'amd64')
+
+ if len(sys.argv) == 5:
+ env_pairs = open(sys.argv[4]).read()[:-2].split('\0')
+ env_dict = dict([item.split('=', 1) for item in env_pairs])
+ else:
+ env_dict = None # Use the default environment.
+
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'),
@@ -57,11 +74,11 @@ def main():
for obj in cobjfiles:
cmd = ('lib /nologo /ignore:4006,4221 /remove:%s%s.obj %s' %
(cvspath, obj, output_lib))
- run(cmd)
+ run(cmd, env_dict)
for obj in cppobjfiles:
cmd = ('lib /nologo /ignore:4006,4221 /remove:%s%s.obj %s' %
(cppvspath, obj, output_lib))
- run(cmd)
+ run(cmd, env_dict)
if __name__ == "__main__":
sys.exit(main())
« no previous file with comments | « base/allocator/BUILD.gn ('k') | build/win/message_compiler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698