#NEWLINE# def versions_from_parentdir( parentdir_prefix , versionfile_source , verbose = False ) : #NEWLINE# #INDENT# if IN_LONG_VERSION_PY : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# here = os . path . realpath ( __file__ ) #NEWLINE# #UNINDENT# except NameError : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# root = here #NEWLINE# for i in range ( len ( versionfile_source . split ( '/' ) ) ) : #NEWLINE# #INDENT# root = os . path . dirname ( root ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# here = os . path . realpath ( sys . argv [ 0 ] ) #NEWLINE# root = os . path . dirname ( here ) #NEWLINE# #UNINDENT# dirname = os . path . basename ( root ) #NEWLINE# if ( not dirname . startswith ( parentdir_prefix ) ) : #NEWLINE# #INDENT# if verbose : #NEWLINE# #INDENT# print ( ( "guessing rootdir is '%s', but '%s' doesn't start with prefix '%s'" % ( root , dirname , parentdir_prefix ) ) ) #NEWLINE# #UNINDENT# return None #NEWLINE# #UNINDENT# return { #NEWLINE# #INDENT# 'version' : dirname [ len ( parentdir_prefix ) : ] , #NEWLINE# 'full' : '' , #NEWLINE# #UNINDENT# }