Skip to content

Commit fb65e70

Browse files
committed
Do not save pip cache when using CACHED_ENVIRONMENT
Saving these files in the tarfile will push/pull on every build and it's useless because if we are saving the environment already, these packages will be already installed there. So, there is no need to keep them in the tarfile to not use them after all.
1 parent 0c0e75e commit fb65e70

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

readthedocs/doc_builder/python_environments.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,17 @@ def _pip_cache_cmd_argument(self):
129129
130130
The decision is made considering if the directories are going to be
131131
cleaned after the build (``RTD_CLEAN_AFTER_BUILD=True`` or project has
132-
the ``CLEAN_AFTER_BUILD`` feature enabled) and project has not the
133-
feature ``CACHED_ENVIRONMENT``. In this case, there is no need to cache
132+
the ``CLEAN_AFTER_BUILD`` feature enabled) or project has the feature
133+
``CACHED_ENVIRONMENT``. In this case, there is no need to cache
134134
anything.
135135
"""
136136
if (
137-
(
138-
settings.RTD_CLEAN_AFTER_BUILD or
139-
self.project.has_feature(Feature.CLEAN_AFTER_BUILD)
140-
) and not self.project.has_feature(Feature.CACHED_ENVIRONMENT)
137+
# Cache is going to be removed anyways
138+
settings.RTD_CLEAN_AFTER_BUILD or
139+
self.project.has_feature(Feature.CLEAN_AFTER_BUILD) or
140+
# Cache will be pushed/pulled each time and won't be used because
141+
# packages are already installed in the environment
142+
self.project.has_feature(Feature.CACHED_ENVIRONMENT)
141143
):
142144
return [
143145
'--no-cache-dir',

0 commit comments

Comments
 (0)