diff --git a/scripts/lib/zulip_tools.py b/scripts/lib/zulip_tools.py index fc6c1d7ce8..2c85fb864f 100755 --- a/scripts/lib/zulip_tools.py +++ b/scripts/lib/zulip_tools.py @@ -56,6 +56,7 @@ def overwrite_symlink(src: str, dst: str) -> None: raise def parse_cache_script_args(description: str) -> argparse.Namespace: + # Keep this in sync with clean_unused_caches in provision_inner.py parser = argparse.ArgumentParser(description=description) parser.add_argument( diff --git a/tools/lib/provision_inner.py b/tools/lib/provision_inner.py index 2f46892b38..7e37c0b614 100755 --- a/tools/lib/provision_inner.py +++ b/tools/lib/provision_inner.py @@ -168,6 +168,20 @@ def need_to_run_configure_rabbitmq(settings_list: List[str]) -> bool: except Exception: return True + +def clean_unused_caches() -> None: + args = argparse.Namespace( + threshold_days=6, + # The defaults here should match parse_cache_script_args in zulip_tools.py + dry_run=False, + verbose=False, + no_headings=True, + ) + from scripts.lib import clean_venv_cache, clean_node_cache, clean_emoji_cache + clean_venv_cache.main(args) + clean_node_cache.main(args) + clean_emoji_cache.main(args) + def main(options: argparse.Namespace) -> int: setup_bash_profile() setup_shell_profile('~/.zprofile') @@ -264,7 +278,7 @@ def main(options: argparse.Namespace) -> int: if destroyed: print("Dropped %s stale test databases!" % (destroyed,)) - run(["scripts/lib/clean-unused-caches", "--threshold=6"]) + clean_unused_caches() # Keeping this cache file around can cause eslint to throw # random TypeErrors when new/updated dependencies are added