forked from marticliment/ElevenClock
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapply_version.py
More file actions
33 lines (26 loc) · 825 Bytes
/
apply_version.py
File metadata and controls
33 lines (26 loc) · 825 Bytes
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
import sys
sys.path.append("elevenclock")
from versions import *
def fileReplaceLinesWith(filename: str, list: dict[str, str]):
f = open(filename, "r+", encoding="utf-8")
data = ""
for line in f.readlines():
match = False
for key, value in list.items():
if (line.startswith(key)):
data += f"{key}{value}"
match = True
continue
if (not match):
data += line
f.seek(0)
f.write(data)
f.truncate()
f.close()
fileReplaceLinesWith("ElevenClock.iss", {
"#define MyAppVersion": f" \"{versionName}\"\n",
})
fileReplaceLinesWith("elevenclock-version-info", {
" StringStruct(u'FileVersion'": f", u'{versionName}'),\n",
" StringStruct(u'ProductVersion'": f", u'{versionName}'),\n",
})