def _get_versioning_metadata():
""" Extracts version metadata from the version control system """
if _is_hg():
commit_summary = local('hg id -i', capture=True).translate("+")
# Extract the current branch/bookmark from the bookmarks list.
bookmarks = local("hg bookmarks", capture=True)
branch = "master"
for line in bookmarks.split("\n"):
if "*" in line:
branch = line.split()[1]
break
elif _is_git():
branch = local("git rev-parse --abbrev-ref HEAD", capture=True)
commit_summary = local('git rev-parse HEAD', capture=True).translate(None, "+")
else:
raise Exception("Not git or hg")
# dpkg requires the version start with a number, so lead with `0-`
version = "0-%s" % commit_summary.split()[0]
return branch, commit_summary, version
fabfile.py 文件源码
python
阅读 18
收藏 0
点赞 0
评论 0
评论列表
文章目录