代码拉取完成,页面将自动刷新
# coding=utf-8
import re
import os
import sys
import subprocess
def replace_file(filename, ver):
f_bak = filename + ".bak"
rf = open(filename, "r")
wf = open(f_bak, "w")
for line in rf:
if "<string>Excel Merge" in line:
wf.write(" <string>Excel Merge v" + ver + "</string>\n")
elif "#define AppVersion" in line:
wf.write("#define AppVersion \"" + ver + "\"\n")
else:
wf.write(line)
rf.close()
wf.close()
os.remove(filename)
os.rename(f_bak, filename)
def main():
if len(sys.argv) == 2:
ver = sys.argv[1]
else:
raise "usage: python replace_ver.py 2017.02"
log_result = subprocess.Popen("svn log -l1 -q svn://git.oschina.net/kylescript/ExcelMerger",
stderr=subprocess.STDOUT,
stdout=subprocess.PIPE, shell=True).communicate()[0]
log_result = log_result.decode('gbk').encode('utf-8')
changelist = re.compile('r[0-9]+').findall(log_result)
ver = ver + "(" + str(changelist[0]) + ")"
# modify main.ui, setup.iss
replace_file("main.ui", ver)
main()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。