wire into main

This commit is contained in:
Paul Gauthier 2023-07-20 08:43:03 -03:00
parent 12cf19010f
commit cc59b10a73
2 changed files with 24 additions and 15 deletions

View file

@ -9,6 +9,7 @@ import openai
from aider import __version__, models
from aider.coders import Coder
from aider.io import InputOutput
from aider.versioncheck import check_version
def get_git_root():
@ -369,7 +370,9 @@ def main(args=None, input=None, output=None):
io.tool_output(f"Aider v{__version__}")
if 'VSCODE_GIT_IPC_HANDLE' in os.environ:
check_version(io.tool_error)
if "VSCODE_GIT_IPC_HANDLE" in os.environ:
args.pretty = False
io.tool_output("VSCode terminal detected, pretty output has been disabled.")

View file

@ -1,23 +1,29 @@
import requests
import pkg_resources
import aider
import sys
from pathlib import Path
from aider.dump import dump
import pkg_resources
import requests
import aider
def check_version(print_cmd):
response = requests.get('https://pypi.org/pypi/aider-chat/json')
data = response.json()
latest_version = data['info']['version']
current_version = pkg_resources.get_distribution('aider-chat').version
try:
response = requests.get("https://pypi.org/pypi/aider-chat/json")
data = response.json()
latest_version = data["info"]["version"]
current_version = aider.__version__
if pkg_resources.parse_version(latest_version) <= pkg_resources.parse_version(current_version):
return
if pkg_resources.parse_version(latest_version) <= pkg_resources.parse_version(
current_version
):
return
print_cmd(f"Newer version v{latest_version} is available. To upgrade, run:")
py = sys.executable
print_cmd(f"{py} -m pip install --upgrade aider-chat")
except Exception as err:
print_cmd(f"Error checking pypi for new version: {err}")
print_cmd(f"Newer version of `aider-chat` available: {latest_version}")
py = Path(sys.executable).name
print_cmd(f"To upgrade, run: {py} -m pip install --upgrade aider-chat")
if __name__ == "__main__":
check_version(print)