fab.steps.cleanup_prebuilds module#

Pruning of old files from the incremental/prebuild folder.

fab.steps.cleanup_prebuilds.cleanup_prebuilds(config, older_than=None, n_versions=0, all_unused=None)#

A step to delete old files from the local incremental/prebuild folder.

Assumes prebuild filenames follow the pattern: <stem>.<hash>.<suffix>.

Parameters:
  • config – The fab.build_config.BuildConfig object where we can read settings such as the project workspace folder or the multiprocessing flag.

  • older_than (Optional[timedelta]) – Delete prebuild artefacts which are n seconds older than the last prebuild access time. (default: None)

  • n_versions (int) – Only keep the most recent n versions of each artefact <stem>.*.<suffix> (default: 0)

  • all_unused (Optional[bool]) – Delete everything which was not part of the current build. (default: None)

If no parameters are specified then all_unused will default to True.

fab.steps.cleanup_prebuilds.by_age(older_than, prebuilds_ts, current_files)#
Return type:

Set[Path]

fab.steps.cleanup_prebuilds.by_version_age(n_versions, prebuilds_ts, current_files)#
Return type:

Set[Path]

fab.steps.cleanup_prebuilds.remove_all_unused(found_files, current_files)#
fab.steps.cleanup_prebuilds.get_access_time(fpath)#

Return the access time of the given file.

Depends on the file system’s ability to report a file’s last access time via the os.stat_result.st_atime returned by Path.stat.

Return type:

datetime