 Chromium Code Reviews
 Chromium Code Reviews Issue 11175016:
  Selective build clobbering feature (landmines.py and android build scripts).  (Closed) 
  Base URL: http://git.chromium.org/chromium/src.git@master
    
  
    Issue 11175016:
  Selective build clobbering feature (landmines.py and android build scripts).  (Closed) 
  Base URL: http://git.chromium.org/chromium/src.git@master| OLD | NEW | 
|---|---|
| (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)) | |
| 
M-A Ruel
2012/10/29 15:10:43
CHROME_SRC = os.path.dirname(SCRIPT_DIR)
 
iannucci
2012/10/29 23:56:39
*facepalm* Done.
 | |
| 12 | |
| 13 | |
| 14 def apply_gyp_environment_from_file(file_path): | |
| 15 """Reads in a *.gyp_env file and applies the valid keys to os.environ.""" | |
| 16 if not os.path.exists(file_path): | |
| 17 return | |
| 18 with open(file_path) as f: | |
| 19 file_contents = f.read() | |
| 20 try: | |
| 21 file_data = eval(file_contents, {'__builtins__': None}, None) | |
| 22 except SyntaxError, e: | |
| 23 e.filename = os.path.abspath(file_path) | |
| 24 raise | |
| 25 supported_vars = ( 'CC', | |
| 26 'CHROMIUM_GYP_FILE', | |
| 27 'CHROMIUM_GYP_SYNTAX_CHECK', | |
| 28 'CXX', | |
| 29 'GYP_DEFINES', | |
| 30 'GYP_GENERATOR_FLAGS', | |
| 31 'GYP_GENERATOR_OUTPUT', | |
| 32 'GYP_GENERATORS', ) | |
| 33 for var in supported_vars: | |
| 34 file_val = file_data.get(var) | |
| 35 if file_val: | |
| 36 if var in os.environ: | |
| 37 print 'INFO: Environment value for "%s" overrides value in %s.' % ( | |
| 38 var, os.path.abspath(file_path) | |
| 39 ) | |
| 40 else: | |
| 41 os.environ[var] = file_val | |
| 42 | |
| 43 | |
| 44 def apply_chromium_gyp_env(): | |
| 45 if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ: | |
| 46 # Update the environment based on chromium.gyp_env | |
| 47 path = os.path.join(os.path.dirname(CHROME_SRC), 'chromium.gyp_env') | |
| 48 apply_gyp_environment_from_file(path) | |
| OLD | NEW |