mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-05 04:05:04 +00:00
refactor: improve pip install error handling and messaging
This commit is contained in:
parent
22318a3160
commit
e9e2afe39f
2 changed files with 12 additions and 13 deletions
|
@ -206,7 +206,7 @@ def get_pip_install(args):
|
|||
|
||||
def run_install(cmd):
|
||||
print()
|
||||
print("Installing: ", " ".join(cmd))
|
||||
print("Installing:", shlex.join(cmd))
|
||||
|
||||
try:
|
||||
output = []
|
||||
|
@ -332,7 +332,8 @@ def check_pip_install_extra(io, module, prompt, pip_install_cmd):
|
|||
io.tool_error(output)
|
||||
|
||||
print()
|
||||
print(f"Failed to install {pip_install_cmd[0]}")
|
||||
print("Install failed, try running this command manually:")
|
||||
print(shlex.join(cmd))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -92,17 +92,15 @@ Newer aider version v{latest_version} is available. To upgrade, run:
|
|||
io.tool_error(text)
|
||||
return True
|
||||
|
||||
cmd = utils.get_pip_install(["--upgrade", "aider-chat"])
|
||||
success = utils.check_pip_install_extra(
|
||||
io,
|
||||
None,
|
||||
f"Newer aider version v{latest_version} is available. To upgrade, run:",
|
||||
["--upgrade", "aider-chat"],
|
||||
)
|
||||
|
||||
text = f"Newer aider version v{latest_version} is available. To upgrade, run:"
|
||||
|
||||
io.tool_error(text)
|
||||
if io.confirm_ask("Run pip install?", subject=shlex.join(cmd)):
|
||||
success, output = utils.run_install(cmd)
|
||||
if success:
|
||||
io.tool_output("Re-run aider to use new version.")
|
||||
sys.exit()
|
||||
else:
|
||||
io.tool_error(output)
|
||||
|
||||
return True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue