#NEWLINE# def parse_changelog( ) : #NEWLINE# #INDENT# with open ( 'CHANGES' ) as f : #NEWLINE# #INDENT# lineiter = iter ( f ) #NEWLINE# for line in lineiter : #NEWLINE# #INDENT# match = re . search ( '^Version\\s+(.*)' , line . strip ( ) ) #NEWLINE# if ( match is None ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# version = match . group ( 1 ) . strip ( ) #NEWLINE# if ( lineiter . next ( ) . count ( '-' ) != len ( line . strip ( ) ) ) : #NEWLINE# #INDENT# fail ( 'Invalid hyphen count below version line: %s' , line . strip ( ) ) #NEWLINE# #UNINDENT# while 1 : #NEWLINE# #INDENT# released = lineiter . next ( ) . strip ( ) #NEWLINE# if released : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# match = re . search ( 'Released (\\w+\\s+\\d+\\w+\\s+\\d+)' , released ) #NEWLINE# if ( match is None ) : #NEWLINE# #INDENT# fail ( ( 'Could not find release date in version %s' % version ) ) #NEWLINE# #UNINDENT# datestr = parse_date ( match . group ( 1 ) . strip ( ) ) #NEWLINE# return ( datestr , datestr )