-
Notifications
You must be signed in to change notification settings - Fork 4
/
version.py
50 lines (33 loc) · 1.36 KB
/
version.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
ver = "2.1.0"
ver_windows = ver.replace(".", ", ") + ", 0"
def windowsVersion():
with open("version.txt", "r") as file:
lines = file.readlines()
if lines[6].strip().startswith("filevers"):
lines[6] = f" filevers=({ver_windows}),\n"
if lines[7].strip().startswith("prodvers"):
lines[7] = f" prodvers=({ver_windows}),\n"
if lines[30].strip().startswith("StringStruct(u'FileVersion'"):
lines[30] = f" StringStruct(u'FileVersion', u'{ver}'),\n"
if lines[33].strip().startswith("StringStruct(u'ProductVersion'"):
lines[33] = f" StringStruct(u'ProductVersion', u'{ver}')])\n"
with open("version.txt", "w") as file:
file.writelines(lines)
def macVersion():
with open("build-mac.spec", "r") as file:
lines = file.readlines()
if lines[53].strip().startswith("version"):
lines[53] = f" version='{ver}',\n"
with open("build-mac.spec", "w") as file:
file.writelines(lines)
def appVersion():
with open("src/module/version.py", "r") as file:
lines = file.readlines()
if lines[12].strip().startswith("current_version"):
lines[12] = f' current_version = "{ver}"\n'
with open("src/module/version.py", "w") as file:
file.writelines(lines)
windowsVersion()
macVersion()
appVersion()
print(f"版本已更改至{ver}")