#NEWLINE# def write_version_py( ) : #NEWLINE# #INDENT# version_py = os . path . join ( os . path . dirname ( __file__ ) , 'bcbiovm' , 'version.py' ) #NEWLINE# try : #NEWLINE# #INDENT# import subprocess #NEWLINE# p = subprocess . Popen ( [ 'git' , 'rev-parse' , '--short' , 'HEAD' ] , stdout = subprocess . PIPE ) #NEWLINE# githash = p . stdout . read ( ) . strip ( ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# githash = '' #NEWLINE# #UNINDENT# with open ( version_py , 'w' ) as out_handle : #NEWLINE# #INDENT# out_handle . write ( '\n' . join ( [ ( '__version__ = "%s"' % version ) , ( '__git_revision__ = "%s"' % p ) ] ) )