Skip to content

Commit 718aa8e

Browse files
committed
Install latest version of pip
Closes readthedocs#4823
1 parent 7f2b831 commit 718aa8e

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

readthedocs/doc_builder/python_environments.py

+21-10
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,24 @@ def setup_base(self):
223223

224224
def install_core_requirements(self):
225225
"""Install basic Read the Docs requirements into the virtualenv."""
226+
pip_install_cmd = [
227+
'python',
228+
self.venv_bin(filename='pip'),
229+
'install',
230+
'--upgrade',
231+
'--cache-dir',
232+
self.project.pip_cache_path,
233+
]
234+
235+
# Install latest pip first,
236+
# so it is used when installing the other requirements.
237+
cmd = pip_install_cmd + ['pip==18.1']
238+
self.build_env.run(
239+
*cmd,
240+
bin_path=self.venv_bin(),
241+
cwd=self.checkout_path
242+
)
243+
226244
requirements = [
227245
'Pygments==2.2.0',
228246
# Assume semver for setuptools version, support up to next backwards
@@ -255,21 +273,14 @@ def install_core_requirements(self):
255273
'readthedocs-sphinx-ext<0.6'
256274
])
257275

258-
cmd = [
259-
'python',
260-
self.venv_bin(filename='pip'),
261-
'install',
262-
'--upgrade',
263-
'--cache-dir',
264-
self.project.pip_cache_path,
265-
]
276+
cmd = pip_install_cmd
266277
if self.config.python.use_system_site_packages:
267278
# Other code expects sphinx-build to be installed inside the
268279
# virtualenv. Using the -I option makes sure it gets installed
269280
# even if it is already installed system-wide (and
270281
# --system-site-packages is used)
271-
cmd.append('-I')
272-
cmd.extend(requirements)
282+
cmd += ['-I']
283+
cmd += requirements
273284
self.build_env.run(
274285
*cmd,
275286
bin_path=self.venv_bin(),

readthedocs/rtd_tests/tests/test_doc_building.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ def test_install_core_requirements_sphinx(self, checkout_path):
11931193
]
11941194
requirements = self.base_requirements + requirements_sphinx
11951195
args = self.pip_install_args + requirements
1196-
self.build_env_mock.run.assert_called_once()
1196+
self.assertEqual(self.build_env_mock.run.call_count, 2)
11971197
self.assertArgsStartsWith(args, self.build_env_mock.run)
11981198

11991199
@patch('readthedocs.projects.models.Project.checkout_path')
@@ -1212,7 +1212,7 @@ def test_install_core_requirements_mkdocs(self, checkout_path):
12121212
]
12131213
requirements = self.base_requirements + requirements_mkdocs
12141214
args = self.pip_install_args + requirements
1215-
self.build_env_mock.run.assert_called_once()
1215+
self.assertEqual(self.build_env_mock.run.call_count, 2)
12161216
self.assertArgsStartsWith(args, self.build_env_mock.run)
12171217

12181218
@patch('readthedocs.projects.models.Project.checkout_path')

0 commit comments

Comments
 (0)