(path, content)
return True
Will backup the file then patch it
Will backup the file then patch it
Will backup the file then patch it
def _patch_file(path, content):
    """Will backup the file then patch it"""
    existing_content = open(path).read()
    if existing_content == content:
        # already patched
        log.warn('Already patched.')
        return False
    log.warn('Patching...')
    _rename_path(path)
    f = open(path, 'w')
    try:
        f.write(content)
    finally:
        f.close()
    return True
def _patch_file ( path , content ) : existing_content = open ( path ) . read ( ) if existing_content == content : # already patched log . warn ( 'Already patched.' ) return False log . warn ( 'Patching...' ) _rename_path ( path ) f = open ( path , 'w' ) try : f . write ( content ) finally : f . close ( ) return True