#NEWLINE# def get_version( ) : #NEWLINE# #INDENT# 'Fetch the current version from git, if possible.' #NEWLINE# git_dir = os . path . join ( os . path . dirname ( __file__ ) , '../.git' ) #NEWLINE# if ( not os . path . isdir ( git_dir ) ) : #NEWLINE# #INDENT# return VERSION_UNKNOWN #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# cmd = [ 'git' , 'describe' , '--tags' , '--dirty' , '--always' ] #NEWLINE# ver = subprocess . check_output ( cmd ) #NEWLINE# #UNINDENT# except subprocess . CalledProcessError : #NEWLINE# #INDENT# return VERSION_UNKNOWN #NEWLINE# #UNINDENT# return pep440_version ( parse_version ( ver ) )