#NEWLINE# def _backup( self , filename , move = True ) : #NEWLINE# #INDENT# ipath = path . normpath ( path . join ( self . installpath , filename ) ) #NEWLINE# bpath = path . normpath ( path . join ( self . backuppath , filename ) ) #NEWLINE# if ( not path . isfile ( ipath ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# bdir = path . dirname ( bpath ) #NEWLINE# if ( not path . isdir ( bdir ) ) : #NEWLINE# #INDENT# os . makedirs ( bdir ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# if move : #NEWLINE# #INDENT# log . debug ( 'Backing up file {0} by moving to backup directory' . format ( filename ) ) #NEWLINE# shutil . move ( ipath , bpath ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# log . debug ( 'Backing up file {0} by copying to backup directory' . format ( filename ) ) #NEWLINE# shutil . copy ( ipath , bpath ) #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# log . debug ( 'Backup failed for {0}' . format ( filename ) )