#NEWLINE# def run( self ) : #NEWLINE# #INDENT# if ( self . formats != [ 'gztar' ] ) : #NEWLINE# #INDENT# print ( "'setup.py sdist' unsupported format." ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# if glob . glob ( '*.tar.gz' ) : #NEWLINE# #INDENT# print ( "'setup.py sdist' remove existing *.tar.gz files from source directory." ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# command = 'make dist' #NEWLINE# exit_code = subprocess . call ( command , shell = True ) #NEWLINE# if ( exit_code != 0 ) : #NEWLINE# #INDENT# raise RuntimeError ( 'Running: {0:s} failed.' . format ( command ) ) #NEWLINE# #UNINDENT# if ( not os . path . exists ( 'dist' ) ) : #NEWLINE# #INDENT# os . mkdir ( 'dist' ) #NEWLINE# #UNINDENT# source_package_file = glob . glob ( '*.tar.gz' ) [ 0 ] #NEWLINE# ( source_package_prefix , _ , source_package_suffix ) = source_package_file . partition ( '-' ) #NEWLINE# sdist_package_file = '{0:s}-python-{1:s}' . format ( dist_files , source_package_suffix ) #NEWLINE# sdist_package_file = os . path . join ( 'dist' , sdist_package_file ) #NEWLINE# os . rename ( source_package_file , sdist_package_file ) #NEWLINE# dist_files = getattr ( self . distribution , 'dist_files' , [ ] ) #NEWLINE# dist_files . append ( ( 'sdist' , '' , sdist_package_file ) )