def start_server(host, port, interpreter):
    if port == 0:
        host = ''

    try:
        from _pydev_xmlrpc_hook import InputHookedXMLRPCServer as XMLRPCServer  #@UnusedImport
    except:
        #I.e.: supporting the internal Jython version in PyDev to create a Jython interactive console inside Eclipse.
        from pydev_imports import SimpleXMLRPCServer as XMLRPCServer  #@Reimport

    try:
        server = XMLRPCServer((host, port), logRequests=False, allow_none=True)

    except:
        sys.stderr.write('Error starting server with host: %s, port: %s, client_port: %s\n' % (host, port, client_port))
        raise

    server.register_function(interpreter.execLine)
    server.register_function(interpreter.execMultipleLines)
    server.register_function(interpreter.getCompletions)
    server.register_function(interpreter.getFrame)
    server.register_function(interpreter.getVariable)
    server.register_function(interpreter.changeVariable)
    server.register_function(interpreter.getDescription)
    server.register_function(interpreter.close)
    server.register_function(interpreter.interrupt)
    server.register_function(handshake)
    server.register_function(interpreter.connectToDebugger)

    if IPYTHON:
        try:
            interpreter.interpreter.ipython.hooks.editor = ipython_editor(interpreter)
        except:
            pass

    if port == 0:
        (h, port) = server.socket.getsockname()

        print(port)
        print(client_port)


    sys.stderr.write(interpreter.get_greeting_msg())
    sys.stderr.flush()

    interpreter.server = server
    server.serve_forever()

    return server
def start_server(host, port, interpreter):
    if port == 0:
        host = ''

    try:
        from _pydev_xmlrpc_hook import InputHookedXMLRPCServer as XMLRPCServer  #@UnusedImport
    except:
        #I.e.: supporting the internal Jython version in PyDev to create a Jython interactive console inside Eclipse.
        from pydev_imports import SimpleXMLRPCServer as XMLRPCServer  #@Reimport

    try:
        server = XMLRPCServer((host, port), logRequests=False, allow_none=True)

    except:
        sys.stderr.write(
            'Error starting server with host: %s, port: %s, client_port: %s\n'
            % (host, port, client_port))
        raise

    server.register_function(interpreter.execLine)
    server.register_function(interpreter.execMultipleLines)
    server.register_function(interpreter.getCompletions)
    server.register_function(interpreter.getFrame)
    server.register_function(interpreter.getVariable)
    server.register_function(interpreter.changeVariable)
    server.register_function(interpreter.getDescription)
    server.register_function(interpreter.close)
    server.register_function(interpreter.interrupt)
    server.register_function(handshake)
    server.register_function(interpreter.connectToDebugger)

    if IPYTHON:
        try:
            interpreter.interpreter.ipython.hooks.editor = ipython_editor(
                interpreter)
        except:
            pass

    if port == 0:
        (h, port) = server.socket.getsockname()

        print(port)
        print(client_port)

    sys.stderr.write(interpreter.get_greeting_msg())
    sys.stderr.flush()

    interpreter.server = server
    server.serve_forever()

    return server
Beispiel #3
0
def StartServer(host, port, client_port):
    # replace exit (see comments on method)
    # note that this does not work in jython!!! (sys method can't be replaced).
    sys.exit = _DoExit

    from _pydev_xmlrpc_hook import InputHookedXMLRPCServer
    try:
        server = InputHookedXMLRPCServer((host, port), logRequests=False)
        exec_queue = Queue.Queue()
        interpreter = InterpreterInterface(host, client_port, server, exec_queue)
        client_server = xmlrpclib.Server('http://%s:%s' % (host, client_port))
    except:
        sys.stderr.write('Error starting server with host: %s, port: %s, client_port: %s\n' % (host, port, client_port))
        raise

    # Tell UMD the proper default namespace
    _set_globals_function(interpreter.getNamespace)

    # Functions for basic protocol
    server.register_function(interpreter.addExec)
    server.register_function(interpreter.getCompletions)
    server.register_function(interpreter.getDescription)
    server.register_function(interpreter.close)
    server.register_function(interpreter.interrupt)

    # Functions so that the console can work as a debugger (i.e.: variables view, expressions...)
    server.register_function(interpreter.connectToDebugger)
    server.register_function(interpreter.hello)

    # Functions for GUI main loop integration
    server.register_function(interpreter.enableGui)

    from threading import Thread
    Thread(target=server.serve_forever).start()
    return server, exec_queue, interpreter, client_server
Beispiel #4
0
def StartServer(host, port, client_port):
    # replace exit (see comments on method)
    # note that this does not work in jython!!! (sys method can't be replaced).
    sys.exit = _DoExit

    from _pydev_xmlrpc_hook import InputHookedXMLRPCServer
    try:
        server = InputHookedXMLRPCServer((host, port), logRequests=False)
        interpreter = InterpreterInterface(host, client_port, server)
    except:
        sys.stderr.write(
            'Error starting server with host: %s, port: %s, client_port: %s\n'
            % (host, port, client_port))
        raise

    # Tell UMD the proper default namespace
    _set_globals_function(interpreter.getNamespace)

    # Functions for basic protocol
    server.register_function(interpreter.addExec)
    server.register_function(interpreter.getCompletions)
    server.register_function(interpreter.getDescription)
    server.register_function(interpreter.close)

    # Functions so that the console can work as a debugger (i.e.: variables view, expressions...)
    server.register_function(interpreter.connectToDebugger)
    server.register_function(interpreter.hello)

    # Functions for GUI main loop integration
    server.register_function(interpreter.enableGui)

    server.serve_forever()
def StartServer(host, port, client_port):
    # replace exit (see comments on method)
    # note that this does not work in jython!!! (sys method can't be replaced).
    sys.exit = _DoExit

    try:
        from _pydev_xmlrpc_hook import InputHookedXMLRPCServer as XMLRPCServer  #@UnusedImport
    except:
        #I.e.: supporting the internal Jython version in PyDev to create a Jython interactive console inside Eclipse.
        from pydev_imports import SimpleXMLRPCServer as XMLRPCServer  #@Reimport
    try:
        server = XMLRPCServer((host, port), logRequests=False)
        interpreter = InterpreterInterface(host, client_port, server)
    except:
        sys.stderr.write('Error starting server with host: %s, port: %s, client_port: %s\n' % (host, port, client_port))
        raise

    # Tell UMD the proper default namespace
    _set_globals_function(interpreter.getNamespace)

    # Functions for basic protocol
    server.register_function(interpreter.addExec)
    server.register_function(interpreter.getCompletions)
    server.register_function(interpreter.getDescription)
    server.register_function(interpreter.close)

    # Functions so that the console can work as a debugger (i.e.: variables view, expressions...)
    server.register_function(interpreter.connectToDebugger)
    server.register_function(interpreter.hello)

    # Functions for GUI main loop integration
    server.register_function(interpreter.enableGui)


    server.serve_forever()