| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
import sys |
| 9 |
sys.dont_write_bytecode = True |
| 10 |
|
| 11 |
import os |
| 12 |
import socket |
| 13 |
|
| 14 |
import BackendTool |
| 15 |
import SeascopeServer |
| 16 |
|
| 17 |
def start(plist, host, port): |
| 18 |
if not BackendTool.load_projects(plist): |
| 19 |
sys.exit(-1) |
| 20 |
|
| 21 |
SeascopeServer.start_server(host, port) |
| 22 |
|
| 23 |
if __name__ == '__main__': |
| 24 |
import optparse |
| 25 |
usage = "usage: %prog [options] [project_path ...]" |
| 26 |
op = optparse.OptionParser(usage=usage) |
| 27 |
op.add_option("-H", "--host", dest="host", default="127.0.0.1", help="Host") |
| 28 |
op.add_option("-P", "--port", dest="port", type='int', default=8650, help="Port") |
| 29 |
(options, args) = op.parse_args() |
| 30 |
|
| 31 |
if options.port > 65535: |
| 32 |
print('options.port > 65535') |
| 33 |
sys.exit(-1) |
| 34 |
|
| 35 |
plist = [] |
| 36 |
for p in args: |
| 37 |
if not os.path.isdir(p): |
| 38 |
print('%p is not a directory') |
| 39 |
sys.exit(-2) |
| 40 |
plist.append(os.path.abspath(p)) |
| 41 |
|
| 42 |
|
| 43 |
start(plist, options.host, options.port) |