forked from jsbursik/DynamicTariffs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.py
35 lines (27 loc) · 842 Bytes
/
release.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
from os.path import dirname, abspath
from zipfile import ZipFile
import platform
import json
opsys = platform.system()
mod_path = dirname(abspath(__file__))
mod_name = ""
utility = False
if opsys.lower() == "windows":
stripped_path = mod_path.split("\\")
mod_name = stripped_path[-1]
if opsys.lower() == "linux":
stripped_path = mod_path.split("/")
mod_name = stripped_path[-1]
mod_info = open("mod_info.json", "r")
json_object = json.load(mod_info)
mod_info.close()
version = input("Enter new version number: ")
json_object["version"] = version
mod_info = open("mod_info.json", "w")
json.dump(json_object, mod_info, indent=4)
mod_info.close()
file_name = mod_name + ".zip"
with ZipFile(file_name, "w") as myzip:
myzip.write(f"jars/{mod_name}.jar")
myzip.write("mod_info.json")
myzip.write("settings.json")