src/eric7/eric7_server.py

branch
server
changeset 10531
3308e8349e4c
child 10597
fbe93720ee9f
equal deleted inserted replaced
10530:684f491a3bfc 10531:3308e8349e4c
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 # Copyright (c) 2024 Detlev Offenbach <detlev@die-offenbachs.de>
5 #
6
7 """
8 eric-ide Server.
9
10 This is the main Python script of the eric-ide server. This is a server to perform
11 remote development (e.g. code hosted on another computer or through a docker
12 container).
13 """
14
15 import argparse
16 import socket
17 import sys
18
19 from eric7.RemoteServer.EricServer import EricServer
20 from eric7.UI.Info import Version
21
22
23 def createArgumentParser():
24 """
25 Function to create an argument parser.
26
27 @return created argument parser object
28 @rtype argparse.ArgumentParser
29 """
30 parser = argparse.ArgumentParser(
31 description=(
32 "Start the eric-ide server component. This will listen for connections"
33 " from the eric IDE in order to perform remote development."
34 ),
35 epilog="Copyright (c) 2024 Detlev Offenbach <detlev@die-offenbachs.de>.",
36 )
37
38 parser.add_argument(
39 "-p",
40 "--port",
41 type=int,
42 default=42024,
43 help="Listen on the given port for connections from an eric IDE."
44 )
45 parser.add_argument(
46 "-6",
47 "--with-ipv6",
48 action="store_true",
49 help="Listen on IPv6 interfaces as well if the system supports the creation"
50 "of TCP sockets which can handle both IPv4 and IPv6. {0}".format(
51 "This system supports this feature."
52 if socket.has_dualstack_ipv6()
53 else "This system does not support this feature. Option will be ignored."
54 )
55 )
56 parser.add_argument(
57 "-V",
58 "--version",
59 action="version",
60 version="%(prog)s {0}".format(Version),
61 help="Show version information and exit.",
62 )
63
64 return parser
65
66
67 def main():
68 """
69 Main entry point into the application.
70 """
71 global supportedExtensions
72
73 parser = createArgumentParser()
74 args = parser.parse_args()
75
76 server = EricServer(port=args.port, useIPv6=args.with_ipv6)
77 ok = server.run()
78
79 sys.exit(0 if ok else 1)
80
81
82 if __name__ == "__main__":
83 main()
84
85 #
86 # eflag: noqa = M801

eric ide

mercurial