mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-06 02:25:23 +00:00
tools: print package name to be installed
This was hard-coded to argh, which is the only package that uses it for now, but the function may be used elsewhere in the future. Also don't print a newline so the user can answer the prompt on the same line after the [y/N]. BUG=None TEST=Run tools/cl without python3-argh installed Change-Id: I587fd1ded81f21724169a2fe90445f6055d1f421 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3764375 Tested-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Dennis Kempin <denniskempin@google.com> Auto-Submit: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Dennis Kempin <denniskempin@google.com>
This commit is contained in:
parent
e487d4a56c
commit
a3da0f9803
1 changed files with 5 additions and 1 deletions
|
@ -26,7 +26,11 @@ def ensure_package_exists(package: str):
|
|||
try:
|
||||
__import__(package)
|
||||
except ImportError:
|
||||
print("Missing the python package argh. Do you want to install? [y/N]")
|
||||
print(
|
||||
f"Missing the python package {package}. Do you want to install? [y/N] ",
|
||||
end="",
|
||||
flush=True,
|
||||
)
|
||||
response = sys.stdin.readline()
|
||||
if response[:1].lower() == "y":
|
||||
subprocess.check_call([sys.executable, "-m", "pip", "install", "--user", package])
|
||||
|
|
Loading…
Reference in a new issue