blob: eb83cac04d4dc391b0a208943d05ac465854ca1e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
r"""
Phony tool to modify a file in place for testing SCons.
Drops lines that match a pattern. Currently used to test
ranlib and ar behavior without actually invoking those tools.
"""
import sys
def rewrite():
line = ('/*' + sys.argv[1] + '*/\n').encode('utf-8')
with open(sys.argv[2], 'rb') as ifp:
lines = [ln for ln in ifp if ln != line]
with open(sys.argv[2], 'wb') as ofp:
ofp.writelines(lines)
if __name__ == '__main__':
rewrite()
sys.exit(0)
|