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

def _git_str_subprocess ( gitpath ) : if ( not os . path . isdir ( os . path . join ( gitpath , '.git' ) ) ) : return None try : cid = subprocess . check_output ( [ 'git' , 'describe' , '--tags' , '--dirty' , '--always' ] , cwd = gitpath ) . decode ( 'UTF-8' ) . strip ( ) date = subprocess . check_output ( [ 'git' , 'show' , '-s' , '--format=%ci' , 'HEAD' ] , cwd = gitpath ) . decode ( 'UTF-8' ) . strip ( ) return '{} ({})' . format ( cid , date ) except ( subprocess . CalledProcessError , OSError ) : return None
try to get the git commit id and timestamp by calling git .