From 50035a40adcb111b98581a58cc466363bfa8be00 Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Mon, 14 Jan 2019 20:05:30 -0500 Subject: [PATCH] Use python from virtualenv's bin directory 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. --- readthedocs/doc_builder/python_environments.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/readthedocs/doc_builder/python_environments.py b/readthedocs/doc_builder/python_environments.py index 3f4c34a0eab..e2e511b3d28 100644 --- a/readthedocs/doc_builder/python_environments.py +++ b/readthedocs/doc_builder/python_environments.py @@ -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', @@ -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', @@ -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', @@ -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):