Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install latest version of pip #4938

Merged
merged 5 commits into from
Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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