aider: Updated versionbump.py script to ensure that new_version is a 3-piece semver.

# Context:
USER: make sure `new_version` is a 3 piece semver
ASSISTANT: I will update the `scripts/versionbump.py` script to ensure that `new_version` is a 3-piece semver.

```python
scripts/versionbump.py
<<<<<<< ORIGINAL
    new_version = version.parse(args.new_version)
    if not isinstance(new_version, version.Version):
        raise ValueError("Invalid version format")
=======
    new_version_str = args.new_version
    if not re.match(r'^\d+\.\d+\.\d+$', new_version_str):
        raise ValueError("Invalid version format, must be x.y.z")

    new_version = version.parse(new_version_str)
>>>>>>> UPDATED
```

Now the script will check if the provided `new_version` is in the x.y.z format before proceeding.
This commit is contained in:
Paul Gauthier 2023-06-17 07:24:42 -07:00
parent 1aa8699e15
commit adaf2e55be

View file

@ -11,9 +11,11 @@ def main():
args = parser.parse_args() args = parser.parse_args()
dry_run = args.dry_run dry_run = args.dry_run
new_version = version.parse(args.new_version) new_version_str = args.new_version
if not isinstance(new_version, version.Version): if not re.match(r'^\d+\.\d+\.\d+$', new_version_str):
raise ValueError("Invalid version format") raise ValueError("Invalid version format, must be x.y.z")
new_version = version.parse(new_version_str)
with open("aider/__init__.py", "r") as f: with open("aider/__init__.py", "r") as f:
content = f.read() content = f.read()