1 Star 0 Fork 0

Chi.Zhang/protobuf

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
update_compatibility_version.py 1.37 KB
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/env python
"""Compatibility tests between last released and the current version.
Usage: ./update_compatibility_version.py <MAJOR>.<MINOR>.<MICRO> [<RC version>]
Example: ./update_compatibility_version.py 3.7.1
"""
from __future__ import print_function
import re
import sys
if len(sys.argv) < 2 or len(sys.argv) > 3:
print("""
[ERROR] Please specify a version.
./update_compatibility_version.py.py <MAJOR>.<MINOR>.<MICRO> [<RC version>]
Example:
./update_compatibility_version.py.py 3.7.1 2
""")
exit(1)
NEW_VERSION = sys.argv[1]
NEW_VERSION_INFO = NEW_VERSION.split('.')
if len(NEW_VERSION_INFO) != 3:
print("""
[ERROR] Version must be in the format <MAJOR>.<MINOR>.<MICRO>
Example:
./update_compatibility_version.py.py 3.7.3
""")
exit(1)
if len(sys.argv) > 2:
RC_VERSION = int(sys.argv[2])
# Do not update compatibility versions for rc release
if RC_VERSION != 0:
exit(0)
def RewriteTextFile(filename, line_rewriter):
lines = open(filename, 'r').readlines()
updated_lines = []
for line in lines:
updated_lines.append(line_rewriter(line))
if lines == updated_lines:
print('%s was not updated. Please double check.' % filename)
f = open(filename, 'w')
f.write(''.join(updated_lines))
f.close()
def ReplaceVersion(line):
return re.sub(r'LAST_RELEASED=.*$', 'LAST_RELEASED=%s' % NEW_VERSION, line)
RewriteTextFile('tests.sh', ReplaceVersion)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/akenzc/protobuf.git
[email protected]:akenzc/protobuf.git
akenzc
protobuf
protobuf
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385