Skip to content

Commit ef5d497

Browse files
authored
Merge pull request #6820 from readthedocs/humitos/no-cache-pip
Do not save pip cache when using CACHED_ENVIRONMENT
2 parents c38c19b + fb65e70 commit ef5d497

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)