<s> import subprocess <EOL> import os . path <EOL> try : <EOL> if os . path . isdir ( '<STR_LIT>' ) : <EOL> p = subprocess . Popen ( [ '<STR_LIT>' , '<STR_LIT>' , r'<STR_LIT>' ] , <EOL> stdout = subprocess . PIPE , stderr = subprocess . PIPE ) <EOL> if not p . returncode : <EOL> fh = open ( '<STR_LIT>' , '<STR_LIT:w>' ) <EOL> fh . write ( ( p . communicate ( ) [ <NUM_LIT:0> ] . splitlines ( ) [ <NUM_LIT:0> ] or '<STR_LIT>' ) . decode ( '<STR_LIT:utf-8>' ) ) <EOL> fh . close ( ) <EOL> except ( OSError , IndexError ) : <EOL> pass <EOL> try : <EOL> hgrev = open ( '<STR_LIT>' ) . read ( ) <EOL> except IOError : <EOL> hgrev = '<STR_LIT>' <EOL> name = '<STR_LIT>' <EOL> authors = '<STR_LIT>' <EOL> copyright_years = '<STR_LIT>' <EOL> version = '<STR_LIT>' % hgrev <EOL> release = version </s>
