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

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: Total rewrite :). 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 import os
M-A Ruel 2012/10/24 00:40:58 Copyright line.
iannucci 2012/10/24 04:12:25 Done
2
3 def apply_gyp_environment(file_path=None):
M-A Ruel 2012/10/24 00:40:58 why =None?
iannucci 2012/10/24 04:12:25 This whole function was transplanted verbatim from
4 """
M-A Ruel 2012/10/24 00:40:58 In general we start the comment right after """.
iannucci 2012/10/24 04:12:25 Done
5 Reads in a *.gyp_env file and applies the valid keys to os.environ.
6 """
7 if not file_path or not os.path.exists(file_path):
8 return
9 file_contents = open(file_path).read()
iannucci 2012/10/24 04:12:25 I went ahead and put a 'with' on this... No reason
10 try:
11 file_data = eval(file_contents, {'__builtins__': None}, None)
12 except SyntaxError, e:
13 e.filename = os.path.abspath(file_path)
14 raise
15 supported_vars = ( 'CC',
16 'CHROMIUM_GYP_FILE',
17 'CHROMIUM_GYP_SYNTAX_CHECK',
18 'CXX',
19 'GYP_DEFINES',
20 'GYP_GENERATOR_FLAGS',
21 'GYP_GENERATOR_OUTPUT',
22 'GYP_GENERATORS', )
23 for var in supported_vars:
24 val = file_data.get(var)
M-A Ruel 2012/10/24 00:40:58 val&var are confusing, find a better variable name
iannucci 2012/10/24 04:12:25 Better?
25 if val:
26 if var in os.environ:
27 print 'INFO: Environment value for "%s" overrides value in %s.' % (
M-A Ruel 2012/10/24 00:40:58 Is this necessary? Because otherwise you could do:
iannucci 2012/10/24 04:12:25 Again, moved from gyp_chromium :D. Did this have a
M-A Ruel 2012/10/24 12:16:10 No idea. I don't mind though.
28 var, os.path.abspath(file_path)
29 )
30 else:
31 os.environ[var] = val
32
33 def apply_chromium_gyp_env():
M-A Ruel 2012/10/24 00:40:58 The function names are really confusing.
iannucci 2012/10/24 04:12:25 New ones better?
34 script_dir = os.path.dirname(os.path.realpath(__file__))
M-A Ruel 2012/10/24 00:40:58 You can only do that while the module is being par
iannucci 2012/10/24 04:12:25 Good catch
35 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir))
36
37 if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ:
38 # Update the environment based on chromium.gyp_env
39 path = os.path.join(os.path.dirname(chrome_src), 'chromium.gyp_env')
40 apply_gyp_environment(path)
41
M-A Ruel 2012/10/24 00:40:58 Remove extraneous line.
OLDNEW
« no previous file with comments | « build/gyp_chromium ('k') | build/landmines.py » ('j') | build/landmines.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698