2018-04-27 17:04:52 +02:00
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import io
|
2020-09-30 11:36:49 +02:00
|
|
|
import re
|
2018-04-27 17:04:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
def main(argv):
|
|
|
|
# Fix paths in lcov files generated on a Windows host so they match our
|
|
|
|
# current source layout.
|
|
|
|
paths = argv[1:]
|
|
|
|
|
|
|
|
for path in paths:
|
|
|
|
print("cov-fixup:", path)
|
|
|
|
text = io.open(path, "r", encoding="utf-8").read()
|
|
|
|
text = text.replace("\\\\", "/")
|
2024-08-02 11:00:44 +02:00
|
|
|
text = text.replace("\\", "/")
|
2020-09-30 11:36:49 +02:00
|
|
|
old_root = re.search(":(.*?)/glib/.*?$", text, re.MULTILINE).group(1)
|
2018-04-27 17:04:52 +02:00
|
|
|
new_root = os.path.dirname(os.getcwd())
|
|
|
|
if old_root != new_root:
|
|
|
|
print("replacing %r with %r" % (old_root, new_root))
|
|
|
|
text = text.replace(old_root, new_root)
|
|
|
|
with io.open(path, "w", encoding="utf-8") as h:
|
|
|
|
h.write(text)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
sys.exit(main(sys.argv))
|