mirror of
https://github.com/Relintai/scons_gd.git
synced 2025-03-12 18:38:59 +01:00
21 lines
491 B
Python
21 lines
491 B
Python
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)
|