#NEWLINE# def copy_file( self , path , prefixed_path , source_storage ) : #NEWLINE# #INDENT# '\n        Attempt to copy ``path`` with storage\n        ' #NEWLINE# if ( prefixed_path in self . copied_files ) : #NEWLINE# #INDENT# return self . log ( ( "Skipping '%s' (already copied earlier)" % path ) ) #NEWLINE# #UNINDENT# if ( not self . delete_file ( path , prefixed_path , source_storage ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# source_path = source_storage . path ( path ) #NEWLINE# if self . dry_run : #NEWLINE# #INDENT# self . log ( ( "Pretending to copy '%s'" % source_path ) , level = 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . log ( ( "Copying '%s'" % source_path ) , level = 1 ) #NEWLINE# if self . local : #NEWLINE# #INDENT# full_path = self . storage . path ( prefixed_path ) #NEWLINE# try : #NEWLINE# #INDENT# os . makedirs ( os . path . dirname ( full_path ) ) #NEWLINE# #UNINDENT# except OSError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# with source_storage . open ( path ) as source_file : #NEWLINE# #INDENT# self . storage . save ( prefixed_path , source_file ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not ( prefixed_path in self . copied_files ) ) : #NEWLINE# #INDENT# self . copied_files . append ( prefixed_path )