From 1351034b43565a83d39749eb130648c8d781b793 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 18 Mar 2020 10:44:21 -0700 Subject: [PATCH] Skip .cache directory for cached builds if it does not exist --- readthedocs/projects/tasks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/readthedocs/projects/tasks.py b/readthedocs/projects/tasks.py index 645523b3efb..6697cc25f30 100644 --- a/readthedocs/projects/tasks.py +++ b/readthedocs/projects/tasks.py @@ -157,7 +157,8 @@ def push_cached_environment(self): # Special handling for .cache directory because it's per-project path = os.path.join(project_path, '.cache') - tar.add(path, arcname='.cache') + if os.path.exists(path): + tar.add(path, arcname='.cache') storage = get_storage_class(settings.RTD_BUILD_ENVIRONMENT_STORAGE)() with open(tmp_filename, 'rb') as fd: