Skip to content

Commit

Permalink
Use python from virtualenv's bin directory
Browse files Browse the repository at this point in the history
We are executing python commands like

`python /path/to/bin/command`

Sometimes it gives a non-deterministic behaviour.
Like using pip from the virtualenv in the first build
and using pip from the global installation other times.

Commands like sphinx-build and mkdocs have an `console_scripts` entry
point and shouldn't be a problem.
  • Loading branch information
stsewd committed Jan 15, 2019
1 parent 33ed273 commit 50035a4
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions readthedocs/doc_builder/python_environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ def install_package(self):
','.join(self.config.python.extra_requirements)
)
self.build_env.run(
'python',
self.venv_bin(filename='pip'),
self.venv_bin(filename='python'),
'-m',
'pip',
'install',
'--ignore-installed',
'--cache-dir',
Expand All @@ -89,7 +90,7 @@ def install_package(self):
)
elif self.config.python.install_with_setup:
self.build_env.run(
'python',
self.venv_bin(filename='python'),
'setup.py',
'install',
'--force',
Expand Down Expand Up @@ -229,8 +230,9 @@ 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'),
self.venv_bin(filename='python'),
'-m',
'pip',
'install',
'--upgrade',
'--cache-dir',
Expand Down Expand Up @@ -308,8 +310,9 @@ def install_user_requirements(self):

if requirements_file_path:
args = [
'python',
self.venv_bin(filename='pip'),
self.venv_bin(filename='python'),
'-m',
'pip',
'install',
]
if self.project.has_feature(Feature.PIP_ALWAYS_UPGRADE):
Expand Down

0 comments on commit 50035a4

Please sign in to comment.