Skip to content

Commit

Permalink
fix: version update in files by update_ninja_version.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeut committed Jul 24, 2021
1 parent 99f1c24 commit dda4db6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/update_ninja_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,19 @@ def _update_file(filepath, regex, replacement, verbose=True):


def update_docs(upstream_repository, version):
pattern = re.compile(r"ninja \d.\d.\d(\.[\w\-]+)*")
pattern = re.compile(r"ninja \d+.\d+.\d+(\.[\w\-]+)*")
replacement = "ninja %s" % version
_update_file(
os.path.join(ROOT_DIR, "README.rst"),
pattern, replacement)

pattern = re.compile(r"(?<=v)\d.\d.\d(?:\.[\w\-]+)*(?=(?:\.zip|\.tar\.gz|\/))")
pattern = re.compile(r"(?<=v)\d+.\d+.\d+(?:\.[\w\-]+)*(?=(?:\.zip|\.tar\.gz|\/))")
replacement = version
_update_file(
os.path.join(ROOT_DIR, "docs/update_ninja_version.rst"),
pattern, replacement)

pattern = re.compile(r"(?<!v)\d.\d.\d(?:\.[\w\-]+)*")
pattern = re.compile(r"(?<!v)\d+.\d+.\d+(?:\.[\w\-]+)*")
replacement = version
_update_file(
os.path.join(ROOT_DIR, "docs/update_ninja_version.rst"),
Expand All @@ -173,7 +173,7 @@ def update_tests(version):
parts[3] = "git"
version = ".".join(parts)

pattern = re.compile(r'expected_version = "\d.\d.\d(\.[\w\-]+)*"')
pattern = re.compile(r'expected_version = "\d+.\d+.\d+(\.[\w\-]+)*"')
replacement = 'expected_version = "%s"' % version
_update_file(os.path.join(
ROOT_DIR, "tests/test_distribution.py"), pattern, replacement)
Expand Down

0 comments on commit dda4db6

Please sign in to comment.