Skip to content

Commit ddc4398

Browse files
committed
v2.2.5_开始打包
1 parent d0d20a8 commit ddc4398

File tree

3 files changed

+30
-34
lines changed

3 files changed

+30
-34
lines changed

app/tools/variable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
# -------------------- 软件基本信息 --------------------
1010
APPLY_NAME = "SecRandom" # 软件名称
1111
VERSION = "v0.0.0" # 软件当前版本
12-
NEXT_VERSION = "v2.3.0-beta.1" # 软件下一个版本
13-
CODENAME = "Shirako" # 软件代号
12+
NEXT_VERSION = "v2.2.5" # 软件下一个版本
13+
CODENAME = "Koharu" # 软件代号
1414
SPECIAL_VERSION = VERSION if VERSION != "v0.0.0" else NEXT_VERSION
1515
SYSTEM = "windows" if os.name == "nt" else "linux" # 软件系统
1616
ARCH = "x64" if SYSTEM == "windows" else "amd64" # 软件架构

update_version.py

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,47 @@
33

44

55
def get_version_from_env():
6-
raw_version = os.getenv("VERSION", "v0.0.0")
7-
stripped_version = re.sub(r"^v", "", raw_version)
8-
9-
pre_release_suffix = ""
10-
if "-" in stripped_version:
11-
_, pre_release_suffix = stripped_version.split("-", 1)
12-
pre_release_suffix = f"-{pre_release_suffix}"
13-
6+
original_version = os.getenv("VERSION", "v0.0.0")
7+
stripped_version = re.sub(r"^v", "", original_version)
148
# 匹配数字版本部分,包括预发布版本标识符之前的部分
159
numeric_version = re.search(
1610
r"^(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:\.(\d+))?", stripped_version
1711
)
1812
if numeric_version:
19-
major = int(numeric_version.group(1))
20-
minor = int(numeric_version.group(2) or 0)
21-
patch = int(numeric_version.group(3) or 0)
22-
23-
version_3 = f"{major}.{minor}.{patch}"
24-
original_version = f"v{version_3}{pre_release_suffix}"
13+
parts = numeric_version.groups(default="0")
14+
# 确保至少有三位数字
15+
if parts[2] is None:
16+
stripped_version = f"{parts[0]}.{parts[1]}.0"
17+
elif parts[3] is None:
18+
stripped_version = f"{parts[0]}.{parts[1]}.{parts[2]}"
19+
else:
20+
stripped_version = ".".join(parts)
2521
else:
26-
version_3 = "0.0.0"
22+
stripped_version = "0.0.0"
2723
original_version = "v0.0.0"
28-
return original_version, version_3
24+
return original_version, stripped_version
2925

3026

3127
def update_version_info(version):
32-
# 处理三位数字的版本号
28+
# 处理三位或四位数字的版本号
3329
version_parts = version.split(".")
34-
# 确保有三位数字
35-
while len(version_parts) < 3:
30+
# 确保有四位数字
31+
while len(version_parts) < 4:
3632
version_parts.append("0")
37-
# 只取前三位
38-
major, minor, patch = map(int, version_parts[:3])
33+
# 只取前四位
34+
major, minor, patch, build = map(int, version_parts[:4])
3935

40-
version_tuple = (major, minor, patch)
41-
version_str = f"{major}.{minor}.{patch}"
36+
version_tuple = (major, minor, patch, build)
37+
version_str = f"{major}.{minor}.{patch}.{build}"
4238

4339
with open("version_info.txt", "r", encoding="utf-8") as f:
4440
content = f.read()
4541

4642
content = re.sub(
47-
r"filevers=\(\d, \d, \d(?:, \d)?\)", f"filevers={version_tuple}", content
43+
r"filevers=\(\d, \d, \d, \d\)", f"filevers={version_tuple}", content
4844
)
4945
content = re.sub(
50-
r"prodvers=\(\d, \d, \d(?:, \d)?\)", f"prodvers={version_tuple}", content
46+
r"prodvers=\(\d, \d, \d, \d\)", f"prodvers={version_tuple}", content
5147
)
5248
content = re.sub(
5349
r"StringStruct\(u\'FileVersion\', u\'[^\']+\'\)",
@@ -87,7 +83,7 @@ def update_iss_version(stripped_version):
8783

8884

8985
if __name__ == "__main__":
90-
original_version, version_3 = get_version_from_env()
91-
update_version_info(version_3)
86+
original_version, stripped_version = get_version_from_env()
87+
update_version_info(stripped_version)
9288
update_config_py(original_version)
93-
update_iss_version(version_3)
89+
update_iss_version(stripped_version)

version_info.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
VSVersionInfo(
66
ffi=FixedFileInfo(
7-
filevers=(0, 0, 0),
8-
prodvers=(0, 0, 0),
7+
filevers=(0, 0, 0, 0),
8+
prodvers=(0, 0, 0, 0),
99
mask=0x3f,
1010
flags=0x0,
1111
OS=0x40004,
@@ -20,12 +20,12 @@ VSVersionInfo(
2020
u'080404B0',
2121
[StringStruct(u'CompanyName', u'SecRandom'),
2222
StringStruct(u'FileDescription', u'SecRandom'),
23-
StringStruct(u'FileVersion', u'0.0.0'),
23+
StringStruct(u'FileVersion', u'0.0.0.0'),
2424
StringStruct(u'InternalName', u'SecRandom'),
2525
StringStruct(u'LegalCopyright', u'版权所有 © 2025 SecRandom'),
2626
StringStruct(u'OriginalFilename', u'SecRandom.exe'),
2727
StringStruct(u'ProductName', u'SecRandom'),
28-
StringStruct(u'ProductVersion', u'0.0.0')])
28+
StringStruct(u'ProductVersion', u'0.0.0.0')])
2929
]),
3030
VarFileInfo([VarStruct(u'Translation', [2052, 1200])])
3131
]

0 commit comments

Comments
 (0)