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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/gyp_chromium ('k') | build/landmines.py » ('j') | build/landmines.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/gyp_helper.py
diff --git a/build/gyp_helper.py b/build/gyp_helper.py
new file mode 100644
index 0000000000000000000000000000000000000000..260329ac42e445c1e6e60507257c850df2fd93ad
--- /dev/null
+++ b/build/gyp_helper.py
@@ -0,0 +1,41 @@
+import os
M-A Ruel 2012/10/24 00:40:58 Copyright line.
iannucci 2012/10/24 04:12:25 Done
+
+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
+ """
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
+ Reads in a *.gyp_env file and applies the valid keys to os.environ.
+ """
+ if not file_path or not os.path.exists(file_path):
+ return
+ file_contents = open(file_path).read()
iannucci 2012/10/24 04:12:25 I went ahead and put a 'with' on this... No reason
+ try:
+ file_data = eval(file_contents, {'__builtins__': None}, None)
+ except SyntaxError, e:
+ e.filename = os.path.abspath(file_path)
+ raise
+ supported_vars = ( 'CC',
+ 'CHROMIUM_GYP_FILE',
+ 'CHROMIUM_GYP_SYNTAX_CHECK',
+ 'CXX',
+ 'GYP_DEFINES',
+ 'GYP_GENERATOR_FLAGS',
+ 'GYP_GENERATOR_OUTPUT',
+ 'GYP_GENERATORS', )
+ for var in supported_vars:
+ 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?
+ if val:
+ if var in os.environ:
+ 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.
+ var, os.path.abspath(file_path)
+ )
+ else:
+ os.environ[var] = val
+
+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?
+ 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
+ chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir))
+
+ if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ:
+ # Update the environment based on chromium.gyp_env
+ path = os.path.join(os.path.dirname(chrome_src), 'chromium.gyp_env')
+ apply_gyp_environment(path)
+
M-A Ruel 2012/10/24 00:40:58 Remove extraneous line.
« 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