forked from DrInfy/sharpy-sc2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dummy_ladder_zip.py
45 lines (32 loc) · 1.2 KB
/
dummy_ladder_zip.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
import os
import sys
import argparse
sys.path.insert(1, "python-sc2")
from bot_loader import BotDefinitions
from version import update_version_txt
root_dir = os.path.dirname(os.path.abspath(__file__))
def main():
definitions = BotDefinitions()
zip_types = definitions.zippable
zip_keys = list(zip_types.keys())
zip_keys.append("all")
parser = argparse.ArgumentParser(
description="Create a Ladder Manager ready zip archive for SC2 AI, AI Arena, Probots, ..."
)
parser.add_argument("-n", "--name", help=f"Bot name: {zip_keys}.")
parser.add_argument("-e", "--exe", help="Also make executable (Requires pyinstaller)", action="store_true")
args = parser.parse_args()
bot_name = args.name
if not os.path.exists("dummy"):
os.mkdir("dummy")
update_version_txt()
if bot_name == "all" or not bot_name:
zip_keys.remove("all")
for key in zip_keys:
zip_types.get(key).create_ladder_zip(args.exe)
else:
if bot_name not in zip_keys:
raise ValueError(f"Unknown bot: {bot_name}, allowed values are: {zip_keys}")
zip_types.get(bot_name).create_ladder_zip(args.exe)
if __name__ == "__main__":
main()