Merge branch 'g-clear-pointer-no-side-effects' into 'master'
[glib.git] / .gitlab-ci / fixup-cov-paths.py
blobd614b60e626bda5fa7d9290c2f2565a995e24cf2
1 import sys
2 import os
3 import io
6 def main(argv):
7 # Fix paths in lcov files generated on a Windows host so they match our
8 # current source layout.
9 paths = argv[1:]
11 for path in paths:
12 print("cov-fixup:", path)
13 text = io.open(path, "r", encoding="utf-8").read()
14 text = text.replace("\\\\", "/")
15 glib_dir = "/glib/"
16 end = text.index(glib_dir)
17 start = text[:end].rindex(":") + 1
18 old_root = text[start:end]
19 assert os.path.basename(os.getcwd()) == "glib"
20 new_root = os.path.dirname(os.getcwd())
21 if old_root != new_root:
22 print("replacing %r with %r" % (old_root, new_root))
23 text = text.replace(old_root, new_root)
24 with io.open(path, "w", encoding="utf-8") as h:
25 h.write(text)
28 if __name__ == "__main__":
29 sys.exit(main(sys.argv))