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

Unified Diff: build/gyp_chromium

Issue 4705001: Add support for a .gyp_env so you don't have to set a bunch of independent... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/gyp_chromium
===================================================================
--- build/gyp_chromium (revision 65393)
+++ build/gyp_chromium (working copy)
@@ -18,6 +18,31 @@
sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
import gyp
+def apply_gyp_environment(file_path=None):
+ """
+ Reads in a *.gyp_env and applies the valid keys to os.environ.
Mark Mentovai 2010/11/08 19:58:21 *.gyp_env file.
+ """
+ if not file_path or not os.path.exists(file_path):
+ return
+ file_contents = open(file_path).read()
+ try:
+ file_data = eval(file_contents, {'__builtins__': None}, None)
+ except SyntaxError, e:
+ e.filename = os.path.abspath(file_path)
+ raise
+ supported_vars = ( 'CHROMIUM_GYP_FILE',
+ 'CHROMIUM_GYP_SYNTAX_CHECK',
+ 'GYP_DEFINES',
+ 'GYP_GENERATOR_FLAGS',
+ 'GYP_GENERATOR_OUTPUT', )
+ for var in supported_vars:
+ val = file_data.get(var)
+ if val:
+ existing_value = os.environ.get(var)
+ if existing_value:
Mark Mentovai 2010/11/08 19:58:21 I would prefer not overwriting existing values at
+ val = existing_value + ' ' + val
+ os.environ[var] = val
+
def additional_include_files(args=[]):
"""
Returns a list of additional (.gypi) files to include, without
@@ -51,6 +76,11 @@
if __name__ == '__main__':
args = sys.argv[1:]
+ if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ:
+ # Update the environment based on .gyp_env
Mark Mentovai 2010/11/08 19:58:21 chromium.gyp_env.
+ gyp_env_path = os.path.join(os.path.dirname(chrome_src), 'chromium.gyp_env')
+ apply_gyp_environment(gyp_env_path)
+
# This could give false positives since it doesn't actually do real option
# parsing. Oh well.
gyp_file_specified = False
« 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