Bug 1730712: Remove external use of _run_pip() r=perftest-reviewers,ahal,sparky

As `_run_pip()` is being removed from `VirtualenvManager` in an upcoming
patch, its usages need to be removed. Besides, they're using an
"internal" function, which is a bit of a smell.

Note that this _could_ have been solved by exposing a public `run_pip()`
function. However, I felt like that was worse because:
* Friction here is good as we try to migrate the codebase to embrace the
  "requirements definition file" technique to install dependencies.
* There could be confusion about the relationship between
  `install_pip_package()` (only works if venv already activated)
  and `_run_pip()`, which works "in general".

Differential Revision: https://phabricator.services.mozilla.com/D130120
This commit is contained in:
Mitchell Hentges
2021-11-16 21:14:41 +00:00
parent cbd9b89289
commit 868bf2dcdf
7 changed files with 66 additions and 16 deletions

View File

@@ -7,6 +7,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import argparse
import logging
import os
import subprocess
import sys
import tempfile
from multiprocessing import cpu_count
@@ -101,9 +102,17 @@ def python(
python_path = which("ipython", path=bindir)
if not python_path:
if not no_virtualenv:
# Use `_run_pip` directly rather than `install_pip_package` to bypass
# Use `pip` directly rather than `install_pip_package()` to bypass
# `req.check_if_exists()` which may detect a system installed ipython.
command_context.virtualenv_manager._run_pip(["install", "ipython"])
subprocess.check_call(
[
command_context.virtualenv_manager.python_path,
"-m",
"pip",
"install",
"ipython",
]
)
python_path = which("ipython", path=bindir)
if not python_path: