def _patch_file(path, content):
existing_content = open(path).read()<EOL>if existing_content == content:<EOL><INDENT>log.warn('<STR_LIT>')<EOL>return False<EOL><DEDENT>log.warn('<STR_LIT>')<EOL>_rename_path(path)<EOL>f = open(path, '<STR_LIT:w>')<EOL>try:<EOL><INDENT>f.write(content)<EOL><DEDENT>finally:<EOL><INDENT>f.close()<EOL><DEDENT>return True<EOL>
Will backup the file then patch it