(file_path=None)
Reads in a *.gyp_env file and applies the valid keys to os.environ.
Reads in a *.gyp_env file and applies the valid keys to os.environ.
Reads in a * . gyp_env file and applies the valid keys to os . environ .
def apply_gyp_environment(file_path=None):
  """
  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()
  try:
    file_data = eval(file_contents, {'__builtins__': None}, None)
  except SyntaxError, e:
    e.filename = os.path.abspath(file_path)
    raise
  supported_vars = ( 'V8_GYP_FILE',
                     'V8_GYP_SYNTAX_CHECK',
                     'GYP_DEFINES',
                     'GYP_GENERATORS',
                     'GYP_GENERATOR_FLAGS',
                     'GYP_GENERATOR_OUTPUT', )
  for var in supported_vars:
    val = file_data.get(var)
    if val:
      if var in os.environ:
        print 'INFO: Environment value for "%s" overrides value in %s.' % (
            var, os.path.abspath(file_path)
        )
      else:
        os.environ[var] = val
def apply_gyp_environment ( file_path = None ) : 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 = ( 'V8_GYP_FILE' , 'V8_GYP_SYNTAX_CHECK' , 'GYP_DEFINES' , 'GYP_GENERATORS' , 'GYP_GENERATOR_FLAGS' , 'GYP_GENERATOR_OUTPUT' , ) for var in supported_vars : val = file_data . get ( var ) if val : if var in os . environ : print 'INFO: Environment value for "%s" overrides value in %s.' % ( var , os . path . abspath ( file_path ) ) else : os . environ [ var ] = val