Fix updating of MODULE.bazel in update_bazel_workspace.py (#1550)

The regex was not matching which caused #1549 to fail.
This commit is contained in:
Sam Clegg
2025-04-15 14:13:21 -07:00
committed by GitHub
parent ed2035a3cc
commit 0992ad5f5d

View File

@@ -64,10 +64,11 @@ def update_module_version(version):
with open(BAZEL_MODULE_FILE, 'r') as f: with open(BAZEL_MODULE_FILE, 'r') as f:
content = f.read() content = f.read()
content = re.sub( pattern = '(module\(\s*name = "emsdk",\s*version = )"\d+.\d+.\d+",\n\)'
r'module\(name = "emsdk", version = "\d+.\d+.\d+"\)', # Verify that the pattern exists in the input since re.sub will
f'module(name = "emsdk", version = "{version}")', # will succeed either way.
content) assert re.search(pattern, content)
content = re.sub(pattern, fr'\1"{version}",\n)', content)
with open(BAZEL_MODULE_FILE, 'w') as f: with open(BAZEL_MODULE_FILE, 'w') as f:
f.write(content) f.write(content)