11version_regex = re.compile(
r"^project\(MLCompilerBridge VERSION (?P<version>[^)]+)\)$")
12toml_field_regex =
r'version[ ]*=[ ]*"(.*)"'
15with open(
"../CMakeLists.txt",
"r")
as f:
17 vmatch = version_regex.match(line)
19 VERSION = vmatch.group(
"version")
22print(
"Version detected =", VERSION)
24with open(
"./pyproject.toml",
"r")
as f:
27with open(
"./pyproject.toml",
"w")
as f:
29 if re.search(toml_field_regex, line):
30 new_text = f
'version = "{VERSION}"\n'