blob: 96ccdcc8bf2c308b38f86271815c340b01229705 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#!/usr/bin/env python3
import os
import pathlib
import sys
if len(sys.argv) < 3:
sys.exit('usage: replacer.py <pattern> <replacement>')
source_root = pathlib.Path(os.environ['MESON_DIST_ROOT'])
modfile = source_root / 'prog.c'
contents = modfile.read_text()
contents = contents.replace(sys.argv[1], sys.argv[2])
modfile.write_text(contents)
|