forked from Team-Neptune/DeepSea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautobuild.py
55 lines (43 loc) · 1.65 KB
/
autobuild.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
51
52
53
54
55
import subprocess
import json
def getModuleMarkdown(_mName, _mVersion):
for module in modules:
if module["name"] != _mName:
continue
url = ""
if module["git"]["service"] == 0:
url = "https://github.com/"
else:
url = "https://gitlab.com/"
url = url + module["git"]["org_name"] + \
"/" + module["git"]["repo_name"]
md = "["+_mName+" - "+_mVersion+"]("+url+")"
return md
with open('VERSION', 'r') as myfile:
data = myfile.read()
obj = json.loads(data)
packages = obj['buildPackages']
version = obj['buildVersion']
with open('./builder/Modules/modules-definitions.json', 'r') as myfile:
data = myfile.read()
modules = json.loads(data)
release = {}
release["bodyText"] = "Release " + version + "\n\n" + \
"DeepSea v" + version + " built with:\n\n"
packageOutputs = ""
for package in packages:
command = 'cd ./builder && python ./builder.py -v v' + \
version+' '+package+'.json output="./' + package+'_v'+version+'.zip"'
process = subprocess.run(command, shell=True, check=True,
stdout=subprocess.PIPE, universal_newlines=True)
print(process.stdout)
packageOutputs = packageOutputs + "\n" + process.stdout
lines = sorted(list(set(packageOutputs.splitlines())))
for line in lines:
if line.startswith(' '):
mName = line.split(" - ")[0].strip()
mVersion = line.split(" - ")[1].strip()
release["bodyText"] = release["bodyText"] + "* " + \
getModuleMarkdown(mName, mVersion) + "\n"
with open("release.txt", 'w') as filetowrite:
filetowrite.write(release["bodyText"])