Skip to content

Commit 8d6c673

Browse files
committed
Add feature flip for always upgrading user defined packages on pip install
We're not yet sure if this will blow up user defined requirements, feature here will be used to test on a sample. Refs #3077 Closes #3077
1 parent 313ef52 commit 8d6c673

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

readthedocs/doc_builder/python_environments.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,21 @@ def install_user_requirements(self):
178178
break
179179

180180
if requirements_file_path:
181-
self.build_env.run(
181+
args = [
182182
'python',
183183
self.venv_bin(filename='pip'),
184184
'install',
185-
'--upgrade',
185+
]
186+
if self.project.has_feature(Feature.PIP_ALWAYS_UPGRADE):
187+
args += ['--upgrade']
188+
args += [
186189
'--exists-action=w',
187190
'--cache-dir',
188191
self.project.pip_cache_path,
189192
'-r{0}'.format(requirements_file_path),
193+
]
194+
self.build_env.run(
195+
*args,
190196
cwd=self.checkout_path,
191197
bin_path=self.venv_bin()
192198
)

readthedocs/projects/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -991,10 +991,12 @@ def add_features(sender, **kwargs):
991991
# may be added by other packages
992992
USE_SPHINX_LATEST = 'use_sphinx_latest'
993993
USE_SETUPTOOLS_LATEST = 'use_setuptools_latest'
994+
PIP_ALWAYS_UPGRADE = 'pip_always_upgrade'
994995

995996
FEATURES = (
996997
(USE_SPHINX_LATEST, _('Use latest version of Sphinx')),
997998
(USE_SETUPTOOLS_LATEST, _('Use latest version of setuptools')),
999+
(PIP_ALWAYS_UPGRADE, _('Always run pip install --upgrade')),
9981000
)
9991001

10001002
project = models.ForeignKey(

0 commit comments

Comments
 (0)