-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwdb.server.py
executable file
·98 lines (86 loc) · 2.45 KB
/
wdb.server.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env python
# Stdlib:
import argparse
from logging import DEBUG, INFO, WARNING, getLogger
# Thirdparty:
import uvloop
from aiomisc import entrypoint
# Firstparty:
from wdb_server.__main__ import WDBService, WDBTCPService
# pylint: disable=missing-function-docstring
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument(
"--debug", action="store_true", help="Debug mode (default False)"
)
parser.add_argument(
"--extra-search-path",
action="store_true",
help=(
"Try harder to find the 'libpython*' shared library at the cost "
"of a slower server startup. (default False)"
),
)
parser.add_argument(
"--more",
action="store_true",
help="Set the debug more verbose (default False)",
)
parser.add_argument(
"--detached_session",
action="store_true",
help="Whether to continue program on browser close (default False)",
)
parser.add_argument(
"--show-filename",
action="store_true",
help="Whether to show filename in session list (default False)",
)
parser.add_argument(
"--server-host",
type=str,
default="localhost",
help="Host used to serve debugging pages (default localhost)",
)
parser.add_argument(
"--server-port",
type=int,
default=1984,
help="Port used to serve debugging pages (default 1984)",
)
parser.add_argument(
"--socket-host",
type=str,
default="localhost",
help="Host used to communicate with wdb instances (default localhost)",
)
parser.add_argument(
"--socket-port",
type=int,
default=19840,
help="Port used to communicate with wdb instances (default 19840)",
)
args = parser.parse_args()
log = getLogger("wdb_server")
if args.debug:
log.setLevel(INFO)
if args.more:
log.setLevel(DEBUG)
else:
log.setLevel(WARNING)
uvloop.install()
services = (
WDBService(
address=args.server_host,
port=args.server_port,
**vars(args),
),
WDBTCPService(address=args.socket_host, port=args.socket_port),
)
with entrypoint(*services) as loop:
try:
loop.run_forever()
except KeyboardInterrupt:
print("Received exit, exiting")
if __name__ == "__main__":
main()