| OLD | NEW |
| 1 # Copyright 2015 the V8 project authors. All rights reserved. | 1 # Copyright 2015 the V8 project authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """ | 5 """ |
| 6 Sets up various automatic gyp environment variables. These are used by | 6 Sets up various automatic gyp environment variables. These are used by |
| 7 gyp_v8 and landmines.py which run at different stages of runhooks. To | 7 gyp_v8 and landmines.py which run at different stages of runhooks. To |
| 8 make sure settings are consistent between them, all setup should happen here. | 8 make sure settings are consistent between them, all setup should happen here. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 return | 24 return |
| 25 file_contents = open(file_path).read() | 25 file_contents = open(file_path).read() |
| 26 try: | 26 try: |
| 27 file_data = eval(file_contents, {'__builtins__': None}, None) | 27 file_data = eval(file_contents, {'__builtins__': None}, None) |
| 28 except SyntaxError, e: | 28 except SyntaxError, e: |
| 29 e.filename = os.path.abspath(file_path) | 29 e.filename = os.path.abspath(file_path) |
| 30 raise | 30 raise |
| 31 supported_vars = ( 'V8_GYP_FILE', | 31 supported_vars = ( 'V8_GYP_FILE', |
| 32 'V8_GYP_SYNTAX_CHECK', | 32 'V8_GYP_SYNTAX_CHECK', |
| 33 'GYP_DEFINES', | 33 'GYP_DEFINES', |
| 34 'GYP_GENERATORS', |
| 34 'GYP_GENERATOR_FLAGS', | 35 'GYP_GENERATOR_FLAGS', |
| 35 'GYP_GENERATOR_OUTPUT', ) | 36 'GYP_GENERATOR_OUTPUT', ) |
| 36 for var in supported_vars: | 37 for var in supported_vars: |
| 37 val = file_data.get(var) | 38 val = file_data.get(var) |
| 38 if val: | 39 if val: |
| 39 if var in os.environ: | 40 if var in os.environ: |
| 40 print 'INFO: Environment value for "%s" overrides value in %s.' % ( | 41 print 'INFO: Environment value for "%s" overrides value in %s.' % ( |
| 41 var, os.path.abspath(file_path) | 42 var, os.path.abspath(file_path) |
| 42 ) | 43 ) |
| 43 else: | 44 else: |
| 44 os.environ[var] = val | 45 os.environ[var] = val |
| 45 | 46 |
| 46 | 47 |
| 47 def set_environment(): | 48 def set_environment(): |
| 48 """Sets defaults for GYP_* variables.""" | 49 """Sets defaults for GYP_* variables.""" |
| 49 | 50 |
| 50 if 'SKIP_V8_GYP_ENV' not in os.environ: | 51 if 'SKIP_V8_GYP_ENV' not in os.environ: |
| 51 # Update the environment based on v8.gyp_env | 52 # Update the environment based on v8.gyp_env |
| 52 gyp_env_path = os.path.join(os.path.dirname(V8_ROOT), 'v8.gyp_env') | 53 gyp_env_path = os.path.join(os.path.dirname(V8_ROOT), 'v8.gyp_env') |
| 53 apply_gyp_environment(gyp_env_path) | 54 apply_gyp_environment(gyp_env_path) |
| 55 |
| 56 if not os.environ.get('GYP_GENERATORS'): |
| 57 # Default to ninja on all platforms. |
| 58 os.environ['GYP_GENERATORS'] = 'ninja' |
| 59 |
| 54 vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs() | 60 vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs() |
| OLD | NEW |