From efbde2ad01ed4f205fcb7859194976fbdcf16d64 Mon Sep 17 00:00:00 2001 From: Riken Shah Date: Fri, 11 Jun 2021 06:00:50 +0000 Subject: [PATCH] provision: Use the `clean_unused_caches.main` function. We currently have created a copy of the `clean_unused_caches.main` function in `provision_inner.py` to clean the unused caches. But as we have now converted the script into a python file we can directly call that function. This commit replaces that function (introduced in https://github.com/zulip/zulip/commit/adc0ed4206d807076519db7a4e52a50fe8b529a2) with `clean_unused_caches.main`. --- tools/lib/provision_inner.py | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/tools/lib/provision_inner.py b/tools/lib/provision_inner.py index 1853bb72b4..5ff8f2bf5b 100755 --- a/tools/lib/provision_inner.py +++ b/tools/lib/provision_inner.py @@ -12,6 +12,7 @@ sys.path.append(ZULIP_PATH) from pygments import __version__ as pygments_version from pytz import VERSION as timezones_version +from scripts.lib import clean_unused_caches from scripts.lib.zulip_tools import ( ENDC, OKBLUE, @@ -202,21 +203,6 @@ def need_to_run_configure_rabbitmq(settings_list: List[str]) -> bool: 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_emoji_cache, clean_node_cache, clean_venv_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") @@ -333,7 +319,15 @@ def main(options: argparse.Namespace) -> int: if destroyed: print(f"Dropped {destroyed} stale test databases!") - clean_unused_caches() + clean_unused_caches.main( + 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, + ) + ) # Keeping this cache file around can cause eslint to throw # random TypeErrors when new/updated dependencies are added