src/build/lacros/test_runner.py
def _remove_unused_ash_chrome_versions(version_to_skip):
  """Removes unused ash-chrome versions to save disk space.

  Currently, when an ash-chrome zip is downloaded and unpacked, the atime/mtime
  of the dir and the files are NOW instead of the time when they were built, but
  there is no garanteen it will always be the behavior in the future, so avoid
  removing the current version just in case.

  Args:
    version_to_skip (str): the version to skip removing regardless of its age.
  """
  days = 7
  expiration_duration = 60 * 60 * 24 * days

  for f in os.listdir(_PREBUILT_ASH_CHROME_DIR):
    if f == version_to_skip:
      continue

    p = os.path.join(_PREBUILT_ASH_CHROME_DIR, f)
    if os.path.isfile(p):
      # The prebuilt ash-chrome dir is NOT supposed to contain any files, remove
      # them to keep the directory clean.
      os.remove(p)
      continue

    age = time.time() - os.path.getatime(os.path.join(p, 'chrome'))
    if age > expiration_duration:
      logging.info(
          'Removing ash-chrome: "%s" as it hasn\'t been used in the '
          'past %d days', p, days)
      shutil.rmtree(p)
Removes unused ash-chrome versions to save disk space.

  Currently, when an ash-chrome zip is downloaded and unpacked, the atime/mtime
  of the dir and the files are NOW instead of the time when they were built, but
  there is no garanteen it will always be the behavior in the future, so avoid
  removing the current version just in case.

  Args:
    version_to_skip (str): the version to skip removing regardless of its age.
  
Removes unused ash-chrome versions to save disk space.
Currently, when an ash-chrome zip is downloaded and unpacked, the atime/mtime
of the dir and the files are NOW instead of the time when they were built, but
there is no garanteen it will always be the behavior in the future, so avoid
removing the current version just in case.
Removes unused ash - chrome versions to save disk space . Currently when an ash - chrome zip is downloaded and unpacked the atime / mtime of the dir and the files are NOW instead of the time when they were built but there is no garanteen it will always be the behavior in the future so avoid removing the current version just in case .
def _remove_unused_ash_chrome_versions(version_to_skip):
  days = 7
  expiration_duration = 60 * 60 * 24 * days
  for f in os.listdir(_PREBUILT_ASH_CHROME_DIR):
    if f == version_to_skip:
      continue
    p = os.path.join(_PREBUILT_ASH_CHROME_DIR, f)
    if os.path.isfile(p):
      os.remove(p)
      continue
    age = time.time() - os.path.getatime(os.path.join(p, 'chrome'))
    if age > expiration_duration:
      logging.info(
          'Removing ash-chrome: "%s" as it hasn\'t been used in the '
          'past %d days', p, days)
      shutil.rmtree(p)
def _remove_unused_ash_chrome_versions ( version_to_skip ) : days = 7 expiration_duration = 60 * 60 * 24 * days for f in os . listdir ( _PREBUILT_ASH_CHROME_DIR ) : if f == version_to_skip : continue p = os . path . join ( _PREBUILT_ASH_CHROME_DIR , f ) if os . path . isfile ( p ) : os . remove ( p ) continue age = time . time ( ) - os . path . getatime ( os . path . join ( p , 'chrome' ) ) if age > expiration_duration : logging . info ( 'Removing ash-chrome: "%s" as it hasn\'t been used in the ' 'past %d days' , p , days ) shutil . rmtree ( p )
Removes unused ash-chrome versions to save disk space.
Removes unused ash - chrome versions to save disk space .
"""Removes unused ash-chrome versions to save disk space.

  Currently, when an ash-chrome zip is downloaded and unpacked, the atime/mtime
  of the dir and the files are NOW instead of the time when they were built, but
  there is no garanteen it will always be the behavior in the future, so avoid
  removing the current version just in case.

  Args:
    version_to_skip (str): the version to skip removing regardless of its age.
  """ # The prebuilt ash-chrome dir is NOT supposed to contain any files, remove # them to keep the directory clean.
version_to_skip
the version to skip removing regardless of its age.
the version to skip removing regardless of its age .