From c3a213269f4c2d87b9bba05eb61cc312b4b50ac1 Mon Sep 17 00:00:00 2001 From: Alena Volkova Date: Thu, 28 Sep 2017 15:08:42 -0400 Subject: [PATCH] provision: Make sure the correct version of pip is installed. pip 8.0+ is required to successfully run the script (otherwise, the prefix option doesn't work). pip 9.0+ is installed because of the safety features. --- tools/provision | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/provision b/tools/provision index a9bdd4a..7d5f276 100755 --- a/tools/provision +++ b/tools/provision @@ -57,8 +57,11 @@ the Python version this command is executed with.""" # the venv's Python interpreter. `--prefix venv_dir` ensures that all modules are installed # in the right place. def install_dependencies(requirements_filename): - if subprocess.call([os.path.join(venv_dir, venv_exec_dir, 'pip'), - 'install', '--prefix', venv_dir, '-r', os.path.join(base_dir, requirements_filename)]): + pip_path = os.path.join(venv_dir, venv_exec_dir, 'pip') + # We first install a modern version of pip that supports --prefix + subprocess.call([pip_path, 'install', 'pip>=9.0']) + if subprocess.call([pip_path, 'install', '--prefix', venv_dir, '-r', + os.path.join(base_dir, requirements_filename)]): raise OSError("The command `pip install -r {}` failed. Dependencies not installed!" .format(os.path.join(base_dir, requirements_filename)))