tools/check_git_config.py
def scan_configuration():
  """Scans local environment for git related configuration values."""
  # Git checkout?
  is_git = is_using_git()

  # On Windows HOME should be set.
  if 'HOME' in os.environ:
    netrc_path = os.path.join(
        os.environ['HOME'],
        '_netrc' if sys.platform.startswith('win') else '.netrc')
  else:
    netrc_path = None

  # Netrc exists?
  is_using_netrc = netrc_path and os.path.exists(netrc_path)

  # Read it.
  netrc_obj = None
  if is_using_netrc:
    try:
      netrc_obj = netrc.netrc(netrc_path)
    except Exception:
      logging.exception('Failed to read netrc from %s', netrc_path)
      netrc_obj = None

  # Read gclient 'src' solution.
  gclient_url, gclient_deps, gclient_managed = read_gclient_solution()

  return {
    'checker_version': CHECKER_VERSION,
    'is_git': is_git,
    'is_home_set': 'HOME' in os.environ,
    'is_using_netrc': is_using_netrc,
    'netrc_file_mode': os.stat(netrc_path).st_mode if is_using_netrc else 0,
    'git_version': get_git_version(),
    'platform': sys.platform,
    'username': getpass.getuser(),
    'git_user_email': read_git_config('user.email') if is_git else '',
    'git_user_name': read_git_config('user.name') if is_git else '',
    'git_insteadof': read_git_insteadof('chromium.googlesource.com'),
    'chromium_netrc_email':
        read_netrc_user(netrc_obj, 'chromium.googlesource.com'),
    'chrome_internal_netrc_email':
        read_netrc_user(netrc_obj, 'chrome-internal.googlesource.com'),
    'gclient_deps': gclient_deps,
    'gclient_managed': gclient_managed,
    'gclient_url': gclient_url,
  }
Scans local environment for git related configuration values.
Scans local environment for git related configuration values.
Scans local environment for git related configuration values .
def scan_configuration():
  is_git = is_using_git()
  if 'HOME' in os.environ:
    netrc_path = os.path.join(
        os.environ['HOME'],
        '_netrc' if sys.platform.startswith('win') else '.netrc')
  else:
    netrc_path = None
  is_using_netrc = netrc_path and os.path.exists(netrc_path)
  netrc_obj = None
  if is_using_netrc:
    try:
      netrc_obj = netrc.netrc(netrc_path)
    except Exception:
      logging.exception('Failed to read netrc from %s', netrc_path)
      netrc_obj = None
  gclient_url, gclient_deps, gclient_managed = read_gclient_solution()
  return {
    'checker_version': CHECKER_VERSION,
    'is_git': is_git,
    'is_home_set': 'HOME' in os.environ,
    'is_using_netrc': is_using_netrc,
    'netrc_file_mode': os.stat(netrc_path).st_mode if is_using_netrc else 0,
    'git_version': get_git_version(),
    'platform': sys.platform,
    'username': getpass.getuser(),
    'git_user_email': read_git_config('user.email') if is_git else '',
    'git_user_name': read_git_config('user.name') if is_git else '',
    'git_insteadof': read_git_insteadof('chromium.googlesource.com'),
    'chromium_netrc_email':
        read_netrc_user(netrc_obj, 'chromium.googlesource.com'),
    'chrome_internal_netrc_email':
        read_netrc_user(netrc_obj, 'chrome-internal.googlesource.com'),
    'gclient_deps': gclient_deps,
    'gclient_managed': gclient_managed,
    'gclient_url': gclient_url,
  }
def scan_configuration ( ) : is_git = is_using_git ( ) if 'HOME' in os . environ : netrc_path = os . path . join ( os . environ [ 'HOME' ] , '_netrc' if sys . platform . startswith ( 'win' ) else '.netrc' ) else : netrc_path = None is_using_netrc = netrc_path and os . path . exists ( netrc_path ) netrc_obj = None if is_using_netrc : try : netrc_obj = netrc . netrc ( netrc_path ) except Exception : logging . exception ( 'Failed to read netrc from %s' , netrc_path ) netrc_obj = None gclient_url , gclient_deps , gclient_managed = read_gclient_solution ( ) return { 'checker_version' : CHECKER_VERSION , 'is_git' : is_git , 'is_home_set' : 'HOME' in os . environ , 'is_using_netrc' : is_using_netrc , 'netrc_file_mode' : os . stat ( netrc_path ) . st_mode if is_using_netrc else 0 , 'git_version' : get_git_version ( ) , 'platform' : sys . platform , 'username' : getpass . getuser ( ) , 'git_user_email' : read_git_config ( 'user.email' ) if is_git else '' , 'git_user_name' : read_git_config ( 'user.name' ) if is_git else '' , 'git_insteadof' : read_git_insteadof ( 'chromium.googlesource.com' ) , 'chromium_netrc_email' : read_netrc_user ( netrc_obj , 'chromium.googlesource.com' ) , 'chrome_internal_netrc_email' : read_netrc_user ( netrc_obj , 'chrome-internal.googlesource.com' ) , 'gclient_deps' : gclient_deps , 'gclient_managed' : gclient_managed , 'gclient_url' : gclient_url , }
Scans local environment for git related configuration values.
Scans local environment for git related configuration values .
"""Scans local environment for git related configuration values.""" # Git checkout? # On Windows HOME should be set. # Netrc exists? # Read it. # Read gclient 'src' solution.