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

Unified Diff: build/toolchain/win/setup_toolchain.py

Issue 2287833002: Revert of Move gyp-win-tool to the GN Windows toolchain. (Closed)
Patch Set: Created 4 years, 4 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/toolchain/win/midl.gni ('k') | build/toolchain/win/tool_wrapper.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/toolchain/win/setup_toolchain.py
diff --git a/build/toolchain/win/setup_toolchain.py b/build/toolchain/win/setup_toolchain.py
index a91043710d58befb140d0aa12437e331c46e9adf..0d0975dfe3a6444719fea252becfd87b37448069 100644
--- a/build/toolchain/win/setup_toolchain.py
+++ b/build/toolchain/win/setup_toolchain.py
@@ -46,7 +46,7 @@
if re.match(envvar + '=', line.lower()):
var, setting = line.split('=', 1)
if envvar == 'path':
- # Our own rules (for running tool_wrapper.py) and other actions in
+ # Our own rules (for running gyp-win-tool) and other actions in
# Chromium rely on python being in the path. Add the path to this
# python here so that if it's not in the path when ninja is run
# later, python will still be found.
@@ -147,16 +147,45 @@
return block
+def _CopyTool(source_path):
+ """Copies the given tool to the current directory, including a warning not
+ to edit it."""
+ with open(source_path) as source_file:
+ tool_source = source_file.readlines()
+
+ # Add header and write it out to the current directory (which should be the
+ # root build dir). Don't write the file if a matching file already exists
+ # because that causes a cascade of unnecessary rebuilds.
+ match = False
+ contents = ''.join([tool_source[0],
+ '# Generated by setup_toolchain.py do not edit.\n']
+ + tool_source[1:])
+ out_path = 'gyp-win-tool'
+ try:
+ with open(out_path, 'rb') as read_tool_file:
+ existing_contents = read_tool_file.read()
+ if existing_contents == contents:
+ match = True
+ except:
+ pass
+ if not match:
+ with open(out_path, 'wb') as write_tool_file:
+ write_tool_file.write(contents)
+
+
def main():
- if len(sys.argv) != 6:
+ if len(sys.argv) != 7:
print('Usage setup_toolchain.py '
- '<visual studio path> <win sdk path> '
+ '<visual studio path> <win tool path> <win sdk path> '
'<runtime dirs> <target_cpu> <include prefix>')
sys.exit(2)
- win_sdk_path = sys.argv[2]
- runtime_dirs = sys.argv[3]
- target_cpu = sys.argv[4]
- include_prefix = sys.argv[5]
+ tool_source = sys.argv[2]
+ win_sdk_path = sys.argv[3]
+ runtime_dirs = sys.argv[4]
+ target_cpu = sys.argv[5]
+ include_prefix = sys.argv[6]
+
+ _CopyTool(tool_source)
cpus = ('x86', 'x64')
assert target_cpu in cpus
« no previous file with comments | « build/toolchain/win/midl.gni ('k') | build/toolchain/win/tool_wrapper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698