#NEWLINE# def find_version( fname ) : #NEWLINE# #INDENT# 'Attempts to find the version number in the file names fname.\n    Raises RuntimeError if not found.\n    ' #NEWLINE# version = '' #NEWLINE# with open ( fname , 'r' ) as fp : #NEWLINE# #INDENT# reg = re . compile ( '__version__ = [\\\'"]([^\\\'"]*)[\\\'"]' ) #NEWLINE# for line in fp : #NEWLINE# #INDENT# m = reg . match ( line ) #NEWLINE# if m : #NEWLINE# #INDENT# version = m . group ( 1 ) #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( not version ) : #NEWLINE# #INDENT# raise RuntimeError ( 'Cannot find version information' ) #NEWLINE# #UNINDENT# return version