def write_targets(targets, **params):
handler = ReplacementHandler(**params)<EOL>for target, regexer in regexer_for_targets(targets):<EOL><INDENT>with open(target) as fh:<EOL><INDENT>lines = fh.readlines()<EOL><DEDENT>lines = replace_lines(regexer, handler, lines)<EOL>with open(target, "<STR_LIT:w>") as fh:<EOL><INDENT>fh.writelines(lines)<EOL><DEDENT><DEDENT>if handler.missing:<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>" % handler.missing<EOL>)<EOL><DEDENT>
Writes version info into version file