forked from KSP-RO/RealismOverhaul
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makeMeta.py
53 lines (48 loc) · 1.39 KB
/
makeMeta.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
import os, argparse, sys, json, glob
class DefaultHelpParser(argparse.ArgumentParser):
def error(self, message):
sys.stderr.write('error: %s\n' % message)
self.print_help()
sys.exit(2)
HELP_DESC = "Creates neccesary metadata files"
parser = DefaultHelpParser(description=HELP_DESC)
parser.add_argument('tag', metavar='tag', type=str, nargs=1,
help='tag of release (e.g. 0.4.6.0')
args = parser.parse_args()
if not args.tag or len(args.tag) < 1:
print "ERROR: git tag must be specified and must be in the format major.minor.patch.build-configuration.e.g. 0.4.6.0"
sys.exit(2)
version = args.tag[0].split("v")[1].split(".")
major = int(version[0])
minor = int(version[1])
patch = int(version[2])
build = 0
if len(version) == 4:
build = int(version[3])
# create AVC .version file
avc = {
"NAME" : "RealismOverhaul",
"URL" : "https://raw.githubusercontent.com/NathanKell/RealismOverhaul/master/RealismOverhaul/RO.version",
"DOWNLOAD" : "https://github.com/NathanKell/RealismOverhaul/releases",
"GITHUB":
{
"USERNAME":"NathanKell",
"REPOSITORY":"RealismOverhaul",
"ALLOW_PRE_RELEASE": False
},
"VERSION" :
{
"MAJOR" : major,
"MINOR" : minor,
"PATCH" : patch,
"BUILD" : build
},
"KSP_VERSION" :
{
"MAJOR" : 1,
"MINOR" : 2,
"PATCH" : 2
}
}
with open("RO.version", "w") as f:
f.write(json.dumps(avc))