#NEWLINE# def upload( self , source , target ) : #NEWLINE# #INDENT# logger . debug ( "Copying '%s' -> '%s'" , source , target ) #NEWLINE# if self . isdir ( target ) : #NEWLINE# #INDENT# target = posixpath . join ( target , os . path . basename ( source ) ) #NEWLINE# #UNINDENT# source = os . path . expanduser ( source ) #NEWLINE# if ( not os . path . isdir ( source ) ) : #NEWLINE# #INDENT# self . _sftp . put ( source , target ) #NEWLINE# return #NEWLINE# #UNINDENT# for ( rootdir , _ , files ) in os . walk ( self ) : #NEWLINE# #INDENT# targetdir = os . path . normpath ( os . path . join ( target , os . path . relpath ( rootdir , source ) ) ) . replace ( '\\' , '/' ) #NEWLINE# self . mkdir ( targetdir ) #NEWLINE# for entry in files : #NEWLINE# #INDENT# local_path = os . path . join ( rootdir , entry ) #NEWLINE# remote_path = posixpath . join ( targetdir , entry ) #NEWLINE# if self . exists ( remote_path ) : #NEWLINE# #INDENT# self . _sftp . unlink ( remote_path ) #NEWLINE# #UNINDENT# self . _sftp . put ( local_path , remote_path )