1 from __future__
import print_function
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.
15 print("cov-fixup:", path
)
16 text
= io
.open(path
, "r", encoding
="utf-8").read()
17 text
= text
.replace("\\\\", "/")
18 end
= text
.index("/gi/")
21 start
= text
[:end
].rindex("\"") + 1
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
:
34 if __name__
== "__main__":
35 sys
.exit(main(sys
.argv
))