clean-unused-caches: Handle non-existent yarn cache.

This commit is contained in:
Robert Imschweiler
2021-04-27 12:18:45 +02:00
committed by Tim Abbott
parent 08f6214829
commit ba25580b19

View File

@@ -20,6 +20,7 @@ def remove_unused_versions_dir(args: argparse.Namespace) -> None:
can always remove the cache entirely.
"""
current_version_dir = os.path.join(YARN_CACHE_PATH, CURRENT_VERSION)
try:
dirs_to_purge = set(
[
os.path.join(YARN_CACHE_PATH, directory)
@@ -27,6 +28,8 @@ def remove_unused_versions_dir(args: argparse.Namespace) -> None:
if directory != CURRENT_VERSION
]
)
except FileNotFoundError:
return
may_be_perform_purging(
dirs_to_purge,