def update_version_py():
if not os.path.isdir(".git"):
print("This does not appear to be a Git repository.")
return
try:
#p = subprocess.Popen(["git", "describe","--tags", "--always"],
# stdout=subprocess.PIPE)
p = subprocess.Popen("git rev-list HEAD --count".split(),
stdout=subprocess.PIPE)
except EnvironmentError:
print("unable to run git, leaving structout/_version.py alone")
return
stdout = p.communicate()[0]
if p.returncode != 0:
print("unable to run git, leaving structout/_version.py alone")
return
ver = "0.0."+stdout.strip()
#ver = str(int(ver,16)) # pypi doesnt like base 16
f = open("structout/_version.py", "w")
f.write(VERSION_PY % ver)
f.close()
print("set structout/_version.py to '%s'" % ver)
评论列表
文章目录