forked from PJB3005/MoMMI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
executable file
·51 lines (39 loc) · 1.33 KB
/
main.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
#!/usr/bin/env python3
import argparse
import asyncio
import logging
import sys
from pathlib import Path
from MoMMI.logsetup import setup_logs
# Do this BEFORE we import master, because it does a lot of event loop stuff.
if sys.platform == "win32":
loop = asyncio.ProactorEventLoop()
asyncio.set_event_loop(loop)
#else:
# try:
# import uvloop
# asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
# except ImportError:
# pass
from MoMMI.master import master
def main() -> None:
version = sys.version_info
if version.major < 3 or (version.major == 3 and version.minor < 6):
logging.critical("You need at least Python 3.6 to run MoMMI.")
sys.exit(1)
setup_logs()
parser = argparse.ArgumentParser()
parser.add_argument("--config-dir", "-c",
default="./config",
help="The directory to read config files from.",
dest="config",
type=Path)
parser.add_argument("--storage-dir", "-s",
default="./data",
help="The directory to use for server data storage.",
dest="data",
type=Path)
args = parser.parse_args()
master.start(args.config, args.data)
if __name__ == "__main__":
main()