mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-06 04: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.io import InputOutput
|
||||||
from aider.llm import litellm # noqa: F401; properly init litellm on launch
|
from aider.llm import litellm # noqa: F401; properly init litellm on launch
|
||||||
from aider.repo import GitRepo
|
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
|
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
|
return 0 if not update_available else 1
|
||||||
|
|
||||||
if args.install_main_branch:
|
if args.install_main_branch:
|
||||||
from aider.versioncheck import install_from_main_branch
|
|
||||||
|
|
||||||
success = install_from_main_branch(io)
|
success = install_from_main_branch(io)
|
||||||
return 0 if success else 1
|
return 0 if success else 1
|
||||||
|
|
||||||
|
|
|
@ -280,6 +280,7 @@ def find_common_root(abs_fnames):
|
||||||
else:
|
else:
|
||||||
return safe_abs_path(os.getcwd())
|
return safe_abs_path(os.getcwd())
|
||||||
|
|
||||||
|
|
||||||
def format_tokens(count):
|
def format_tokens(count):
|
||||||
if count < 1000:
|
if count < 1000:
|
||||||
return f"{count}"
|
return f"{count}"
|
||||||
|
@ -290,20 +291,25 @@ def format_tokens(count):
|
||||||
|
|
||||||
|
|
||||||
def check_pip_install_extra(io, module, prompt, pip_install_cmd):
|
def check_pip_install_extra(io, module, prompt, pip_install_cmd):
|
||||||
try:
|
if module:
|
||||||
__import__(module)
|
try:
|
||||||
return True
|
__import__(module)
|
||||||
except (ImportError, ModuleNotFoundError):
|
return True
|
||||||
pass
|
except (ImportError, ModuleNotFoundError):
|
||||||
|
pass
|
||||||
|
|
||||||
cmd = get_pip_install(pip_install_cmd)
|
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)):
|
if not io.confirm_ask("Run pip install?", default="y", subject=" ".join(cmd)):
|
||||||
return
|
return
|
||||||
|
|
||||||
success, output = run_install(cmd)
|
success, output = run_install(cmd)
|
||||||
if success:
|
if success:
|
||||||
|
if not module:
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
__import__(module)
|
__import__(module)
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -16,8 +16,8 @@ def install_from_main_branch(io):
|
||||||
"""
|
"""
|
||||||
return utils.check_pip_install_extra(
|
return utils.check_pip_install_extra(
|
||||||
io,
|
io,
|
||||||
"aider",
|
None,
|
||||||
"Installing the latest version from the main branch...",
|
"Install the development version of aider from the main branch?",
|
||||||
["--upgrade", "git+https://github.com/paul-gauthier/aider.git"],
|
["--upgrade", "git+https://github.com/paul-gauthier/aider.git"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue