1 Star 0 Fork 0

wolf/Py3dsMax

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
buildVersion.py 1.04 KB
一键复制 编辑 原始数据 按行查看 历史
Mike 提交于 2015-05-12 15:29 . Updates to version.h generation
##
# :namespace buildVersion
#
# :remarks Queries git for version specific info and automaticly generates version.h
#
# :author mikeh@blur.com
# :author Blur Studio
# :date 05/11/15
#
import sys
import re
import datetime
from subprocess import Popen, PIPE
def interrogateGit(arguments, regex):
p = Popen(arguments, stdout=PIPE)
ret, err = p.communicate()
if err:
sys.exit(err)
match = re.match(regex, ret)
if not match:
print 'Unable to find match'
print [ret]
print regex
sys.exit(2)
return match
gitVersion = interrogateGit(
['git', 'describe', '--long'],
r'v(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)-\d+-(?P<rev>[\w]+)'
)
data = gitVersion.groupdict()
revCount = interrogateGit(['git', 'rev-list', 'HEAD', '--count'], r'\d+')
data['revCount'] = revCount.group(0)
time = datetime.datetime.now()
data['datetime'] = time.strftime('%Y/%m/%d %H:%M:%S')
with open('version_h_template.txt') as r:
text = r.read()
with open('version.h', 'w') as v:
output = text.format(**data)
v.write(output)
sys.exit(0)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/wooolf/Py3dsMax.git
git@gitee.com:wooolf/Py3dsMax.git
wooolf
Py3dsMax
Py3dsMax
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385