Skip to content

Commit

Permalink
Fix check
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesbvll committed Sep 24, 2024
1 parent 5fcaff6 commit 1a3ab48
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dev/update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import argparse
import re
import sys
from pathlib import Path


Expand Down Expand Up @@ -55,6 +56,7 @@ def _get_next_version(curr_version, increment):

def _update_versions(file_patterns, replace_strings, new_version, check):
"""Update the version strings in the specified files."""
wrong = False
for pattern in file_patterns:
files = list(Path(__file__).parents[1].glob(pattern))
for file_path in files:
Expand All @@ -68,12 +70,16 @@ def _update_versions(file_patterns, replace_strings, new_version, check):
regex_pattern = re.compile(escaped_s)
content = regex_pattern.sub(s.format(version=new_version), content)
if content != original_content:
wrong = True
if check:
print(f"{file_path} would be updated")
else:
file_path.write_text(content)
print(f"Updated {file_path}")

if wrong and check:
sys.exit("Some version haven't been updated.")


if __name__ == "__main__":
parser = argparse.ArgumentParser(
Expand Down

0 comments on commit 1a3ab48

Please sign in to comment.