mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
This required some code changes because of some breaking changes in `clap` and `tree-sitter`. Also needed to assign a new bazel repo name to the `crates_vendor` to avoid name conflicts in `MODULE.bazel`.
17 lines
397 B
Python
17 lines
397 B
Python
import sys
|
|
import re
|
|
import pathlib
|
|
|
|
label_re = re.compile(r'"@(vendor.*)//:(.+)-([\d.]+)"')
|
|
|
|
file = pathlib.Path(sys.argv[1])
|
|
temp = file.with_suffix(f'{file.suffix}.tmp')
|
|
|
|
|
|
with open(file) as input, open(temp, "w") as output:
|
|
for line in input:
|
|
line = label_re.sub(lambda m: f'"@{m[1]}__{m[2]}-{m[3]}//:{m[2].replace("-", "_")}"', line)
|
|
output.write(line)
|
|
|
|
temp.rename(file)
|