diff --git a/scripts/versionbump.py b/scripts/versionbump.py index aab2c54a0..b7bf70152 100755 --- a/scripts/versionbump.py +++ b/scripts/versionbump.py @@ -95,15 +95,15 @@ def main(): f"{new_version.major}.{new_version.minor}.{new_version.micro + 1}" ) - with open("aider/__init__.py", "r") as f: - content = f.read() + from aider import __version__ as current_version - current_version = re.search(r'__version__ = "(.+?)"', content).group(1) if new_version <= version.parse(current_version): raise ValueError( f"New version {new_version} must be greater than the current version {current_version}" ) + with open("aider/__init__.py", "r") as f: + content = f.read() updated_content = re.sub(r'__version__ = ".+?"', f'__version__ = "{new_version}"', content) print("Updating aider/__init__.py with new version:")