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

Side by Side Diff: build/gyp_helper.py

Issue 11293286: Use universal newlines in gyp_helper. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # This file helps gyp_chromium and landmines correctly set up the gyp 5 # This file helps gyp_chromium and landmines correctly set up the gyp
6 # environment from chromium.gyp_env on disk 6 # environment from chromium.gyp_env on disk
7 7
8 import os 8 import os
9 9
10 SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) 10 SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
11 CHROME_SRC = os.path.dirname(SCRIPT_DIR) 11 CHROME_SRC = os.path.dirname(SCRIPT_DIR)
12 12
13 13
14 def apply_gyp_environment_from_file(file_path): 14 def apply_gyp_environment_from_file(file_path):
15 """Reads in a *.gyp_env file and applies the valid keys to os.environ.""" 15 """Reads in a *.gyp_env file and applies the valid keys to os.environ."""
16 if not os.path.exists(file_path): 16 if not os.path.exists(file_path):
17 return 17 return
18 with open(file_path) as f: 18 with open(file_path, 'rU') as f:
19 file_contents = f.read() 19 file_contents = f.read()
20 try: 20 try:
21 file_data = eval(file_contents, {'__builtins__': None}, None) 21 file_data = eval(file_contents, {'__builtins__': None}, None)
22 except SyntaxError, e: 22 except SyntaxError, e:
23 e.filename = os.path.abspath(file_path) 23 e.filename = os.path.abspath(file_path)
24 raise 24 raise
25 supported_vars = ( 25 supported_vars = (
26 'CC', 26 'CC',
27 'CHROMIUM_GYP_FILE', 27 'CHROMIUM_GYP_FILE',
28 'CHROMIUM_GYP_SYNTAX_CHECK', 28 'CHROMIUM_GYP_SYNTAX_CHECK',
(...skipping 12 matching lines...) Expand all
41 ) 41 )
42 else: 42 else:
43 os.environ[var] = file_val 43 os.environ[var] = file_val
44 44
45 45
46 def apply_chromium_gyp_env(): 46 def apply_chromium_gyp_env():
47 if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ: 47 if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ:
48 # Update the environment based on chromium.gyp_env 48 # Update the environment based on chromium.gyp_env
49 path = os.path.join(os.path.dirname(CHROME_SRC), 'chromium.gyp_env') 49 path = os.path.join(os.path.dirname(CHROME_SRC), 'chromium.gyp_env')
50 apply_gyp_environment_from_file(path) 50 apply_gyp_environment_from_file(path)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698