forked from CorttChan/ArchOctopus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
executable file
·53 lines (42 loc) · 1.3 KB
/
tasks.py
File metadata and controls
executable file
·53 lines (42 loc) · 1.3 KB
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
51
52
53
"""
版本信息
"""
import json
import os
import glob
from datetime import datetime, timedelta
from archoctopus.version import VERSION
def update_plugin_version() -> None:
"""
更新插件版本信息
"""
info = dict()
for name in glob.glob("./archoctopus/plugins/*.py"):
with open(name, 'r', encoding="utf-8") as plugin_file:
for line in plugin_file.readlines():
if line.startswith("# version:"):
info[os.path.basename(name)] = line[10:].strip()
break
else:
info[os.path.basename(name)] = "0.0.1"
with open('./update/plugin_version', 'w') as f:
json.dump(info, f)
def update_release_version() -> None:
"""
更新软件版本信息
"""
date_now = datetime.utcnow() + timedelta(hours=8)
release_version_info = {
"version": VERSION,
"date": date_now.strftime("%Y-%m-%d %H:%M:%S"),
"desc": "",
"url": "https://github.com/CorttChan/ArchOctopus/releases/latest",
"notes": "",
}
with open('./update/release_version', 'w') as f:
json.dump(release_version_info, f)
if __name__ == '__main__':
if not os.path.exists("./update"):
os.mkdir("./update")
update_plugin_version()
update_release_version()