refactor: Improve version handling and cleanup version-related files

This commit is contained in:
Paul Gauthier 2024-11-30 10:10:03 -08:00 committed by Paul Gauthier (aider)
parent 295040c94c
commit 0dbaec553f
5 changed files with 17 additions and 9 deletions

1
.gitignore vendored
View file

@ -11,5 +11,6 @@ _site
.jekyll-cache/
.jekyll-metadata
aider/__version__.py
aider/_version.py
.venv/
.gitattributes

View file

@ -4,14 +4,17 @@ __version__ = "0.65.2.dev"
safe_version = __version__
try:
from aider.__version__ import __version__
from aider._version import __version__
except Exception:
__version__ = safe_version + ".import"
__version__ = safe_version + "+import"
try:
if version.parse(__version__) < version.parse(safe_version):
__version__ = safe_version + ".less"
except Exception:
__version__ = safe_version + ".parse"
if type(__version__) is not str:
__version__ = safe_version + "+type"
else:
try:
if version.parse(__version__) < version.parse(safe_version):
__version__ = safe_version + "+less"
except Exception:
__version__ = safe_version + "+parse"
__all__ = [__version__]

View file

@ -914,7 +914,7 @@ class Commands:
def cmd_quit(self, args):
"Exit the application"
sys.exit()
self.cmd_exit(args)
def cmd_ls(self, args):
"List all known files and indicate which are included in the chat session"

View file

@ -949,6 +949,10 @@ def is_first_run_of_new_version(io, verbose=False):
installs_file = Path.home() / ".aider" / "installs.json"
key = (__version__, sys.executable)
# Never show notes for .dev versions
if ".dev" in __version__:
return False
if verbose:
io.tool_output(
f"Checking imports for version {__version__} and executable {sys.executable}"

View file

@ -67,7 +67,7 @@ requires = ["setuptools>=68", "setuptools_scm[toml]>=8"]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
write_to = "aider/__version__.py"
write_to = "aider/_version.py"
[tool.codespell]
skip = "*.svg,Gemfile.lock"