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

Unified Diff: tools/gn/secondary/build/toolchain/win/setup_toolchain.py

Issue 68793009: Move files from the secondary GN directory to build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « tools/gn/secondary/build/toolchain/win/BUILD.gn ('k') | tools/gn/secondary/build/util/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/secondary/build/toolchain/win/setup_toolchain.py
diff --git a/tools/gn/secondary/build/toolchain/win/setup_toolchain.py b/tools/gn/secondary/build/toolchain/win/setup_toolchain.py
deleted file mode 100644
index bba18dfc57e39401480a8175b9309470444ffb95..0000000000000000000000000000000000000000
--- a/tools/gn/secondary/build/toolchain/win/setup_toolchain.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# 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 re
-import sys
-
-def ExtractImportantEnvironment():
- """Extracts environment variables required for the toolchain from the
- current environment."""
- envvars_to_save = (
- 'goma_.*', # TODO(scottmg): This is ugly, but needed for goma.
- 'Path',
- 'PATHEXT',
- 'SystemRoot',
- 'TEMP',
- 'TMP',
- )
- result = {}
- for envvar in envvars_to_save:
- if envvar in os.environ:
- if envvar == 'Path':
- # 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.
- result[envvar.upper()] = os.path.dirname(sys.executable) + \
- os.pathsep + os.environ[envvar]
- else:
- result[envvar.upper()] = os.environ[envvar]
- for required in ('SYSTEMROOT', 'TEMP', 'TMP'):
- if required not in result:
- raise Exception('Environment variable "%s" '
- 'required to be set to valid path' % required)
- return result
-
-def FormatAsEnvironmentBlock(envvar_dict):
- """Format as an 'environment block' directly suitable for CreateProcess.
- Briefly this is a list of key=value\0, terminated by an additional \0. See
- CreateProcess documentation for more details."""
- block = ''
- nul = '\0'
- for key, value in envvar_dict.iteritems():
- block += key + '=' + value + nul
- block += nul
- 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).
- with open("gyp-win-tool", 'w') as tool_file:
- tool_file.write(''.join([tool_source[0],
- '# Generated by setup_toolchain.py do not edit.\n']
- + tool_source[1:]))
-
-# Find the tool source, it's the first argument, and copy it.
-if len(sys.argv) != 2:
- print "Need one argument (win_tool source path)."
- sys.exit(1)
-CopyTool(sys.argv[1])
-
-# Write the environment file to the current directory.
-environ = FormatAsEnvironmentBlock(ExtractImportantEnvironment())
-with open('environment.x86', 'wb') as env_file:
- env_file.write(environ)
-
« no previous file with comments | « tools/gn/secondary/build/toolchain/win/BUILD.gn ('k') | tools/gn/secondary/build/util/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698