def _git_str():
 if (BASEDIR is None):
  return None
 if (not os.path.isdir(os.path.join(BASEDIR, '.git'))):
  return None
 try:
  cid = subprocess.check_output(['git', 'describe', '--tags', '--dirty', '--always'], cwd=BASEDIR).decode('UTF-8').strip()
  date = subprocess.check_output(['git', 'show', '-s', '--format=%ci', 'HEAD'], cwd=BASEDIR).decode('UTF-8').strip()
  return '{} ({})'.format(cid, date)
 except (subprocess.CalledProcessError, OSError):
  return None

def _git_str ( ) : if ( BASEDIR is None ) : return None if ( not os . path . isdir ( os . path . join ( BASEDIR , '.git' ) ) ) : return None try : cid = subprocess . check_output ( [ 'git' , 'describe' , '--tags' , '--dirty' , '--always' ] , cwd = BASEDIR ) . decode ( 'UTF-8' ) . strip ( ) date = subprocess . check_output ( [ 'git' , 'show' , '-s' , '--format=%ci' , 'HEAD' ] , cwd = BASEDIR ) . decode ( 'UTF-8' ) . strip ( ) return '{} ({})' . format ( cid , date ) except ( subprocess . CalledProcessError , OSError ) : return None
try to find out git version .