mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
add --install-main-branch
This commit is contained in:
parent
898230eb92
commit
b44141f179
3 changed files with 15 additions and 11 deletions
|
@ -17,7 +17,7 @@ from aider.history import ChatSummary
|
|||
from aider.io import InputOutput
|
||||
from aider.llm import litellm # noqa: F401; properly init litellm on launch
|
||||
from aider.repo import GitRepo
|
||||
from aider.versioncheck import check_version
|
||||
from aider.versioncheck import check_version, install_from_main_branch
|
||||
|
||||
from .dump import dump # noqa: F401
|
||||
|
||||
|
@ -431,8 +431,6 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
|||
return 0 if not update_available else 1
|
||||
|
||||
if args.install_main_branch:
|
||||
from aider.versioncheck import install_from_main_branch
|
||||
|
||||
success = install_from_main_branch(io)
|
||||
return 0 if success else 1
|
||||
|
||||
|
|
|
@ -280,6 +280,7 @@ def find_common_root(abs_fnames):
|
|||
else:
|
||||
return safe_abs_path(os.getcwd())
|
||||
|
||||
|
||||
def format_tokens(count):
|
||||
if count < 1000:
|
||||
return f"{count}"
|
||||
|
@ -290,20 +291,25 @@ def format_tokens(count):
|
|||
|
||||
|
||||
def check_pip_install_extra(io, module, prompt, pip_install_cmd):
|
||||
try:
|
||||
__import__(module)
|
||||
return True
|
||||
except (ImportError, ModuleNotFoundError):
|
||||
pass
|
||||
if module:
|
||||
try:
|
||||
__import__(module)
|
||||
return True
|
||||
except (ImportError, ModuleNotFoundError):
|
||||
pass
|
||||
|
||||
cmd = get_pip_install(pip_install_cmd)
|
||||
|
||||
io.tool_error(prompt)
|
||||
if prompt:
|
||||
io.tool_error(prompt)
|
||||
|
||||
if not io.confirm_ask("Run pip install?", default="y", subject=" ".join(cmd)):
|
||||
return
|
||||
|
||||
success, output = run_install(cmd)
|
||||
if success:
|
||||
if not module:
|
||||
return
|
||||
try:
|
||||
__import__(module)
|
||||
return True
|
||||
|
|
|
@ -16,8 +16,8 @@ def install_from_main_branch(io):
|
|||
"""
|
||||
return utils.check_pip_install_extra(
|
||||
io,
|
||||
"aider",
|
||||
"Installing the latest version from the main branch...",
|
||||
None,
|
||||
"Install the development version of aider from the main branch?",
|
||||
["--upgrade", "git+https://github.com/paul-gauthier/aider.git"],
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue