def get_nipype_gitversion():
 import os
 import subprocess
 try:
  import nipype
  gitpath = os.path.realpath(os.path.join(os.path.dirname(nipype.__file__), os.path.pardir))
 except:
  gitpath = os.getcwd()
 gitpathgit = os.path.join(gitpath, u'.git')
 if (not os.path.exists(gitpathgit)):
  return None
 ver = None
 try:
  (o, _) = subprocess.Popen(u'git describe', shell=True, cwd=gitpath, stdout=subprocess.PIPE).communicate()
 except Exception:
  pass
 else:
  ver = o.decode().strip().split(u'-')[(-1)]
 return ver

def get_nipype_gitversion ( ) : import os import subprocess try : import nipype gitpath = os . path . realpath ( os . path . join ( os . path . dirname ( nipype . __file__ ) , os . path . pardir ) ) except : gitpath = os . getcwd ( ) gitpathgit = os . path . join ( gitpath , u'.git' ) if ( not os . path . exists ( gitpathgit ) ) : return None ver = None try : ( o , _ ) = subprocess . Popen ( u'git describe' , shell = True , cwd = gitpath , stdout = subprocess . PIPE ) . communicate ( ) except Exception : pass else : ver = o . decode ( ) . strip ( ) . split ( u'-' ) [ ( - 1 ) ] return ver
nipype version as reported by the last commit in git returns none or str version of nipype according to git .