#NEWLINE# def run( self ) : #NEWLINE# #INDENT# global VERSION #NEWLINE# global RELEASE #NEWLINE# git_head = subprocess . Popen ( 'git log -1 --pretty=format:%h' , shell = True , stdout = subprocess . PIPE ) . communicate ( ) [ 0 ] . strip ( ) #NEWLINE# date = time . strftime ( '%Y%m%d%H%M%S' , time . gmtime ( ) ) #NEWLINE# git_release = ( '%sgit%s' % ( date , git_head ) ) #NEWLINE# spec_in = open ( 'imagefactory-plugins.spec.in' , 'r' ) #NEWLINE# spec = open ( 'imagefactory-plugins.spec' , 'w' ) #NEWLINE# for line in spec_in . xreadlines ( ) : #NEWLINE# #INDENT# if ( '@VERSION@' in line ) : #NEWLINE# #INDENT# line = line . replace ( '@VERSION@' , VERSION ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( '@RELEASE@' in line ) : #NEWLINE# #INDENT# if RELEASE . startswith ( '0' ) : #NEWLINE# #INDENT# RELEASE += ( '.' + git_release ) #NEWLINE# #UNINDENT# line = line . replace ( '@RELEASE@' , RELEASE ) #NEWLINE# #UNINDENT# #UNINDENT# spec . write ( line ) #NEWLINE# #UNINDENT# spec_in . close ( ) #NEWLINE# spec . close ( ) #NEWLINE# _sdist . run ( self )