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

Side by Side Diff: build/gyp_helper.py

Issue 11175016: Selective build clobbering feature (landmines.py and android build scripts). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix nits Created 8 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 # This file helps gyp_chromium and landmines correctly set up the gyp
6 # environment from chromium.gyp_env on disk
7
8 import os
9
10 SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
11 CHROME_SRC = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir))
12
M-A Ruel 2012/10/24 12:16:10 2 lines
13 def apply_gyp_environment_from_file(file_path):
14 """Reads in a *.gyp_env file and applies the valid keys to os.environ."""
15 if not os.path.exists(file_path):
16 return
17 with open(file_path) as f:
18 file_contents = f.read()
19 try:
20 file_data = eval(file_contents, {'__builtins__': None}, None)
21 except SyntaxError, e:
22 e.filename = os.path.abspath(file_path)
23 raise
24 supported_vars = ( 'CC',
25 'CHROMIUM_GYP_FILE',
26 'CHROMIUM_GYP_SYNTAX_CHECK',
27 'CXX',
28 'GYP_DEFINES',
29 'GYP_GENERATOR_FLAGS',
30 'GYP_GENERATOR_OUTPUT',
31 'GYP_GENERATORS', )
32 for var in supported_vars:
33 file_val = file_data.get(var)
34 if file_val:
35 if var in os.environ:
36 print 'INFO: Environment value for "%s" overrides value in %s.' % (
37 var, os.path.abspath(file_path)
38 )
39 else:
40 os.environ[var] = file_val
41
M-A Ruel 2012/10/24 12:16:10 2 lines
42 def apply_chromium_gyp_env():
43 if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ:
44 # Update the environment based on chromium.gyp_env
45 path = os.path.join(os.path.dirname(CHROME_SRC), 'chromium.gyp_env')
46 apply_gyp_environment_from_file(path)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698