#NEWLINE# def parse_readme( library_path ) : #NEWLINE# #INDENT# sections = { #NEWLINE# #INDENT# 'bug_url' : '' , #NEWLINE# 'source_url' : '' , #NEWLINE# #UNINDENT# } #NEWLINE# readme_path = os . path . join ( library_path , 'README.rst' ) #NEWLINE# with open ( readme_path , 'r' ) as fh : #NEWLINE# #INDENT# for line in fh : #NEWLINE# #INDENT# for ( name , key_name ) in [ ( 'Bugs:' , 'bug_url' ) , ( 'Source:' , 'source_url' ) ] : #NEWLINE# #INDENT# pieces = line . split ( name , 1 ) #NEWLINE# if ( len ( pieces ) == 2 ) : #NEWLINE# #INDENT# candidate = pieces [ 1 ] . strip ( ) #NEWLINE# if ( 'http' in candidate ) : #NEWLINE# #INDENT# sections [ key_name ] = candidate #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# for ( k , v ) in sections . items ( ) : #NEWLINE# #INDENT# if ( not v ) : #NEWLINE# #INDENT# what = k . replace ( '_' , ' ' ) #NEWLINE# sys . stderr . write ( ( "WARNING: No %s found in '%s'\n" % ( what , readme_path ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# return key_name