7 # Fix paths in lcov files generated on a Windows host so they match our
8 # current source layout.
12 print("cov-fixup:", path
)
13 text
= io
.open(path
, "r", encoding
="utf-8").read()
14 text
= text
.replace("\\\\", "/")
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
:
28 if __name__
== "__main__":
29 sys
.exit(main(sys
.argv
))