import imp


def LoadExtraSrc(path_to_file):
  """Attempts to load an extra source file, and overrides global values.

  If the extra source file is loaded successfully, then it will use the new
  module to override some global values, such as gclient spec data.

  Args:
    path_to_file: File path.

  Returns:
    The loaded module object, or None if none was imported.
  """
  try:
    global GCLIENT_SPEC_DATA
    global GCLIENT_SPEC_ANDROID
    extra_src = imp.load_source('data', path_to_file)
    GCLIENT_SPEC_DATA = extra_src.GetGClientSpec()
    GCLIENT_SPEC_ANDROID = extra_src.GetGClientSpecExtraParams()
    return extra_src
  except ImportError:
    return None