ci: build python 2.7 and 3.7 in debug mode. Fixes #243
[pygobject.git] / .gitlab-ci / fixup-cov-paths.py
bloba6f43e44b61fe98a67fe854f993f264e63202266
1 from __future__ import print_function
3 import sys
4 import os
5 import io
8 def main(argv):
9 # Fix paths in coverage files to match our current source layout
10 # so that coverage report generators can find the source.
11 # Mostly needed for Windows.
12 paths = argv[1:]
14 for path in paths:
15 print("cov-fixup:", path)
16 text = io.open(path, "r", encoding="utf-8").read()
17 text = text.replace("\\\\", "/")
18 end = text.index("/gi/")
19 try:
20 # coverage.py
21 start = text[:end].rindex("\"") + 1
22 except ValueError:
23 # lcov
24 start = text[:end].rindex(":") + 1
25 old_root = text[start:end]
26 new_root = os.getcwd()
27 if old_root != new_root:
28 print("replacing %r with %r" % (old_root, new_root))
29 text = text.replace(old_root, new_root)
30 with io.open(path, "w", encoding="utf-8") as h:
31 h.write(text)
34 if __name__ == "__main__":
35 sys.exit(main(sys.argv))