The Meson Build System http://mesonbuild.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

16 lines
350 B

#!/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)