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

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

Issue 2023703002: Beginning work on GN build (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Really add //build. Add dart_bootstrap rule. Created 4 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/toolchain/mac/copy_bundle_data.py ('k') | build/toolchain/nacl/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/toolchain/mac/setup_toolchain.py
diff --git a/build/toolchain/mac/setup_toolchain.py b/build/toolchain/mac/setup_toolchain.py
new file mode 100644
index 0000000000000000000000000000000000000000..98b50bebcbab3bb6d14826dc5c8f05fbc0cf1664
--- /dev/null
+++ b/build/toolchain/mac/setup_toolchain.py
@@ -0,0 +1,42 @@
+# Copyright (c) 2013 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.
+
+import os
+import stat
+import sys
+
+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-mac-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)
+ st = os.stat(out_path)
+ if (st.st_mode & stat.S_IEXEC) == 0:
+ # Only chmod when necessary.
+ os.chmod(out_path, st.st_mode | stat.S_IEXEC)
+
+# Find the tool source, it's the first argument, and copy it.
+if len(sys.argv) != 2:
+ print "Need one argument (mac_tool source path)."
+ sys.exit(1)
+CopyTool(sys.argv[1])
« no previous file with comments | « build/toolchain/mac/copy_bundle_data.py ('k') | build/toolchain/nacl/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698