-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_release.py
More file actions
64 lines (48 loc) · 1.66 KB
/
Copy pathcreate_release.py
File metadata and controls
64 lines (48 loc) · 1.66 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
54
55
56
57
58
59
60
61
62
63
64
import datetime
import os
version = input("version: ")
news = []
with open("NEWS", "r") as file:
for item in file.read().split("\n"):
if item != "":
news.append(item)
with open("NEWS", "w") as file:
file.write("")
with open("src/api.py", "r") as file:
content = file.read()
pos = content.find('version = "') + 11
fh = content[:pos]
sh = content[pos:]
pos = sh.find('"')
sh = sh[pos:]
content = fh + version + sh
with open("src/api.py", "w") as file:
file.write(content)
with open("data/page.codeberg.ostfriese4.Untis.metainfo.xml.in") as file:
meta = file.read()
pos = meta.find("<releases>") + 10
description = " <ul>"
for new in news:
description += "\n <li>" + new + "</li>"
description += "\n </ul>\n"
with open("rn","w") as file:
file.write(description)
os.system("nano rn")
with open("rn","r") as file:
description = file.read()
os.system("rm rn")
release = "\n <release version=\"" + version + "\" date=\"" + datetime.date.today().strftime("%Y-%m-%d") + "\">\n <description translate=\"no\">\n" + description + " </description>\n </release>"
meta = meta[:pos] + release + meta[pos:]
with open("data/page.codeberg.ostfriese4.Untis.metainfo.xml.in", "w") as file:
file.write(meta)
with open("src/api.py", "r") as file:
content = file.read()
pos = content.find('releaseNotes = "') + 16
fh = content[:pos]
sh = content[pos:]
pos = sh.find('"#""')
sh = sh[pos:]
releaseNotes = description.replace("\\", "\\\\").replace("\n", "\\n")
content = fh + releaseNotes + sh
with open("src/api.py", "w") as file:
file.write(content)