Skip to content

Commit

Permalink
Merge pull request #4938 from stsewd/install-latest-pip
Browse files Browse the repository at this point in the history
Install latest version of pip
  • Loading branch information
ericholscher authored Dec 4, 2018
2 parents 85d9a1f + 2adec8c commit 50bb883
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
36 changes: 26 additions & 10 deletions readthedocs/doc_builder/python_environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@
"""An abstraction over virtualenv and Conda environments."""

from __future__ import (
absolute_import, division, print_function, unicode_literals)
absolute_import,
division,
print_function,
unicode_literals,
)

import copy
import itertools
import json
import logging
import os
import shutil
from builtins import object, open

import six
from builtins import object, open
from django.conf import settings

from readthedocs.doc_builder.config import load_yaml_config
Expand Down Expand Up @@ -223,6 +228,24 @@ def setup_base(self):

def install_core_requirements(self):
"""Install basic Read the Docs requirements into the virtualenv."""
pip_install_cmd = [
'python',
self.venv_bin(filename='pip'),
'install',
'--upgrade',
'--cache-dir',
self.project.pip_cache_path,
]

# Install latest pip first,
# so it is used when installing the other requirements.
cmd = pip_install_cmd + ['pip']
self.build_env.run(
*cmd,
bin_path=self.venv_bin(),
cwd=self.checkout_path
)

requirements = [
'Pygments==2.2.0',
# Assume semver for setuptools version, support up to next backwards
Expand Down Expand Up @@ -255,14 +278,7 @@ def install_core_requirements(self):
'readthedocs-sphinx-ext<0.6'
])

cmd = [
'python',
self.venv_bin(filename='pip'),
'install',
'--upgrade',
'--cache-dir',
self.project.pip_cache_path,
]
cmd = copy.copy(pip_install_cmd)
if self.config.python.use_system_site_packages:
# Other code expects sphinx-build to be installed inside the
# virtualenv. Using the -I option makes sure it gets installed
Expand Down
4 changes: 2 additions & 2 deletions readthedocs/rtd_tests/tests/test_doc_building.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ def test_install_core_requirements_sphinx(self, checkout_path):
]
requirements = self.base_requirements + requirements_sphinx
args = self.pip_install_args + requirements
self.build_env_mock.run.assert_called_once()
self.assertEqual(self.build_env_mock.run.call_count, 2)
self.assertArgsStartsWith(args, self.build_env_mock.run)

@patch('readthedocs.projects.models.Project.checkout_path')
Expand All @@ -1212,7 +1212,7 @@ def test_install_core_requirements_mkdocs(self, checkout_path):
]
requirements = self.base_requirements + requirements_mkdocs
args = self.pip_install_args + requirements
self.build_env_mock.run.assert_called_once()
self.assertEqual(self.build_env_mock.run.call_count, 2)
self.assertArgsStartsWith(args, self.build_env_mock.run)

@patch('readthedocs.projects.models.Project.checkout_path')
Expand Down

0 comments on commit 50bb883

Please sign in to comment.