#NEWLINE# def run( self , files ) : #NEWLINE# #INDENT# reprounzip . common . record_usage ( upload_files = len ( files ) ) #NEWLINE# input_files = { n : f . path for ( n , f ) in iteritems ( self . get_config ( ) . inputs_outputs ) if f . read_runs } #NEWLINE# if ( not files ) : #NEWLINE# #INDENT# print ( 'Input files:' ) #NEWLINE# for input_name in sorted ( input_files ) : #NEWLINE# #INDENT# assigned = self . input_files . get ( input_name ) #NEWLINE# if ( assigned is None ) : #NEWLINE# #INDENT# assigned = '(original)' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( assigned is False ) : #NEWLINE# #INDENT# assigned = '(not created)' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( assigned is True ) : #NEWLINE# #INDENT# assigned = '(generated)' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# assert isinstance ( assigned , ( bytes , unicode_ ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# print ( ( '    %s: %s' % ( input_name , assigned ) ) ) #NEWLINE# #UNINDENT# return #NEWLINE# #UNINDENT# self . prepare_upload ( files ) #NEWLINE# try : #NEWLINE# #INDENT# for filespec in files : #NEWLINE# #INDENT# filespec_split = filespec . rsplit ( ':' , 1 ) #NEWLINE# if ( len ( filespec_split ) != 2 ) : #NEWLINE# #INDENT# logging . critical ( 'Invalid file specification: %r' , filespec ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# ( local_path , input_name ) = filespec_split #NEWLINE# try : #NEWLINE# #INDENT# input_path = input_files [ input_name ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# logging . critical ( 'Invalid input file: %r' , input_name ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# temp = None #NEWLINE# if ( not local_path ) : #NEWLINE# #INDENT# logging . debug ( 'Restoring input file %s' , input_path ) #NEWLINE# ( fd , temp ) = Path . tempfile ( prefix = 'reprozip_input_' ) #NEWLINE# os . close ( temp ) #NEWLINE# local_path = self . extract_original_input ( input_name , input_path , temp ) #NEWLINE# if ( local_path is None ) : #NEWLINE# #INDENT# temp . remove ( ) #NEWLINE# logging . warning ( "No original packed, can't restore input file %s" , input_name ) #NEWLINE# continue #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# local_path = Path ( local_path ) #NEWLINE# logging . debug ( 'Uploading file %s to %s' , local_path , input_path ) #NEWLINE# if ( not local_path . exists ( ) ) : #NEWLINE# #INDENT# logging . critical ( "Local file %s doesn't exist" , local_path ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# #UNINDENT# self . upload_file ( local_path , input_path ) #NEWLINE# if ( temp is not None ) : #NEWLINE# #INDENT# temp . remove ( ) #NEWLINE# self . input_files . pop ( input_name , None ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . input_files [ input_name ] = local_path . absolute ( ) . path #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# self . finalize ( )