#NEWLINE# def sync_with_s3( self ) : #NEWLINE# #INDENT# '\n        Walk through our self.local_files list, and match them with the list\n        of keys in the S3 bucket.\n        ' #NEWLINE# update_list = [ ] #NEWLINE# for file_key in self . local_file_list : #NEWLINE# #INDENT# abs_file_path = os . path . join ( self . build_dir , file_key ) #NEWLINE# if ( file_key in self . s3_key_dict ) : #NEWLINE# #INDENT# key = self . s3_key_dict [ file_key ] #NEWLINE# s3_md5 = key . etag . strip ( '"' ) #NEWLINE# local_md5 = hashlib . md5 ( open ( abs_file_path , 'rb' ) . read ( ) ) . hexdigest ( ) #NEWLINE# if ( ( s3_md5 == local_md5 ) and ( not self . force_publish ) ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if abs_file_path . force_publish : #NEWLINE# #INDENT# update_list . append ( ( key , abs_file_path ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# update_list . append ( ( key , abs_file_path ) ) #NEWLINE# #UNINDENT# #UNINDENT# del self . s3_key_dict [ file_key ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not self . dry_run ) : #NEWLINE# #INDENT# key = self . bucket . new_key ( file_key ) #NEWLINE# #UNINDENT# update_list . append ( ( ( key or None ) , abs_file_path ) ) #NEWLINE# #UNINDENT# #UNINDENT# if self . no_pooling : #NEWLINE# #INDENT# [ self . upload_to_s3 ( * u ) for u in update_list ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# pool = ThreadPool ( processes = 10 ) #NEWLINE# pool . map ( self . pooled_upload_to_s3 , update_list )