#NEWLINE# def ensure_removed( self , path ) : #NEWLINE# #INDENT# if os . path . exists ( path ) : #NEWLINE# #INDENT# if ( os . path . isdir ( path ) and ( not os . path . islink ( path ) ) ) : #NEWLINE# #INDENT# logger . debug ( 'Removing directory tree at %s' , path ) #NEWLINE# if ( not self . dry_run ) : #NEWLINE# #INDENT# shutil . rmtree ( path ) #NEWLINE# #UNINDENT# if self . record : #NEWLINE# #INDENT# if ( path in self . dirs_created ) : #NEWLINE# #INDENT# self . dirs_created . remove ( path ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if os . path . islink ( path ) : #NEWLINE# #INDENT# s = 'link' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# s = 'file' #NEWLINE# #UNINDENT# logger . debug ( 'Removing %s %s' , s , path ) #NEWLINE# if ( not self . dry_run ) : #NEWLINE# #INDENT# os . remove ( path ) #NEWLINE# #UNINDENT# if self . record : #NEWLINE# #INDENT# if ( path in self . files_written ) : #NEWLINE# #INDENT# self . files_written . remove ( path )