调整win助手安装脚本和自动构建脚本。

pull/130/head
Apex Liu 2018-12-10 00:01:40 +08:00
parent 17fdbd59e2
commit e01bc0893c
4 changed files with 46 additions and 25 deletions

View File

@ -299,10 +299,10 @@ class Builder:
def _update_ver_nsi(self, nsiFilePath, ver):
""" update nsis file version info """
t_ver = ver.split('.')
while len(t_ver) < 4:
while len(t_ver) < 3:
t_ver.append('0')
if len(t_ver) > 4:
if len(t_ver) > 3:
raise RuntimeError('Invalid version for nsis file.')
bOK = False
@ -319,40 +319,61 @@ class Builder:
if nsiline.find('\n') != -1:
nsiline = nsiline[:-1]
if nsiline.find(" FILE_VER") != -1 or nsiline.find(" STR_FILE_VER") != -1:
# cc.v('[ver] old ver: %s' % nsiLines[x])
pos1 = nsiline.find('"')
pos2 = nsiline.rfind('"')
_ver = nsiline[pos1 + 1: pos2]
# if nsiline.find(" FILE_VER") != -1 or nsiline.find(" STR_FILE_VER") != -1:
if nsiline.startswith("!define FILE_VER"):
# # cc.v('[ver] old ver: %s' % nsiLines[x])
# pos1 = nsiline.find('"')
# pos2 = nsiline.rfind('"')
# _ver = nsiline[pos1 + 1: pos2]
nsiSplitList = _ver.split(".")
if (len(nsiSplitList) != 4):
raise RuntimeError('Invalid .nsi file (1).')
if '.'.join(nsiSplitList) == ver:
continue
# nsiSplitList = _ver.split(".")
# if (len(nsiSplitList) != 3):
# raise RuntimeError('Invalid .nsi file (1).')
# if '.'.join(nsiSplitList) == ver:
# continue
# nsiline = '%s\"%d.%d.%d.%d\"\n' % (nsiline[0:pos1], self.major, self.minor, self.revision, self.build)
nsiline = '%s\"%s.%s.%s.%s\"\n' % (nsiline[0:pos1], t_ver[0], t_ver[1], t_ver[2], t_ver[3])
# # nsiline = '%s\"%d.%d.%d.%d\"\n' % (nsiline[0:pos1], self.major, self.minor, self.revision, self.build)
nsiline = '!define FILE_VER \"%s.%s.%s.0\"\n' % (t_ver[0], t_ver[1], t_ver[2])
nsiLines[x] = ""
nsiLines[x] = nsiline
# cc.v('[ver] new ver: %s' % nsiLines[x])
bOK = True
elif nsiline.find(" PRODUCT_VER") != -1:
# cc.v('[ver] old ver: %s' % nsiLines[x])
pos1 = nsiline.find('"')
pos2 = nsiline.rfind('"')
_ver = nsiline[pos1 + 1: pos2]
# elif nsiline.find(" OUT_VER") != -1 or nsiline.find(" STR_OUT_VER") != -1:
elif nsiline.startswith("!define OUT_VER"):
# # cc.v('[ver] old ver: %s' % nsiLines[x])
# pos1 = nsiline.find('"')
# pos2 = nsiline.rfind('"')
# _ver = nsiline[pos1 + 1: pos2]
nsiSplitList = _ver.split(".")
if (len(nsiSplitList) != 2):
raise RuntimeError('Invalid .nsi file (2).')
if '.'.join(nsiSplitList) == '%s.%s' % (t_ver[0], t_ver[1]):
continue
# nsiSplitList = _ver.split(".")
# if (len(nsiSplitList) != 3):
# raise RuntimeError('Invalid .nsi file (1).')
# if '.'.join(nsiSplitList) == ver:
# continue
# nsiline = '%s\"%d.%d.%d.%d\"\n' % (nsiline[0:pos1], self.major, self.minor, self.revision, self.build)
nsiline = '!define OUT_VER \"%s.%s.%s\"\n' % (t_ver[0], t_ver[1], t_ver[2])
nsiLines[x] = ""
nsiLines[x] = nsiline
# cc.v('[ver] new ver: %s' % nsiLines[x])
bOK = True
elif nsiline.startswith("!define PRODUCT_VER"):
# # cc.v('[ver] old ver: %s' % nsiLines[x])
# pos1 = nsiline.find('"')
# pos2 = nsiline.rfind('"')
# _ver = nsiline[pos1 + 1: pos2]
# nsiSplitList = _ver.split(".")
# if (len(nsiSplitList) != 2):
# raise RuntimeError('Invalid .nsi file (2).')
# if '.'.join(nsiSplitList) == '%s.%s' % (t_ver[0], t_ver[1]):
# continue
# nsiline = '%s\"%d.%d\"\n' % (nsiline[0:pos1], self.major, self.minor)
nsiline = '%s\"%s.%s\"\n' % (nsiline[0:pos1], t_ver[0], t_ver[1])
nsiline = '!define PRODUCT_VER \"%s.%s\"\n' % (t_ver[0], t_ver[1])
nsiLines[x] = ""
nsiLines[x] = nsiline

Binary file not shown.

Binary file not shown.

Binary file not shown.