Merge "Fix crashes in various GParamSpec creation functions" into tizen
[platform/upstream/glib.git] / .gitlab-ci / fixup-cov-paths.py
1 import sys
2 import os
3 import io
4 import re
5
6
7 def main(argv):
8     # Fix paths in lcov files generated on a Windows host so they match our
9     # current source layout.
10     paths = argv[1:]
11
12     for path in paths:
13         print("cov-fixup:", path)
14         text = io.open(path, "r", encoding="utf-8").read()
15         text = text.replace("\\\\", "/")
16         old_root = re.search(":(.*?)/glib/.*?$", text, re.MULTILINE).group(1)
17         new_root = os.path.dirname(os.getcwd())
18         if old_root != new_root:
19             print("replacing %r with %r" % (old_root, new_root))
20         text = text.replace(old_root, new_root)
21         with io.open(path, "w", encoding="utf-8") as h:
22             h.write(text)
23
24
25 if __name__ == "__main__":
26     sys.exit(main(sys.argv))