[Idle-dev] [ idlefork-Patches-451088 ] RemoteInterpreter patch to run on win32
by way of Stephen M. Gava <elguavas@users.sourceforge.net>
noreply@sourceforge.net
Mon, 8 Oct 2001 13:05:59 +1000
Patches item #451088, was opened at 2001-08-15 00:01
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=309579&aid=451088&group_id=9
579
Category: None
Group: None
Status: Open
>Resolution: Later
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: Stephen M. Gava (elguavas)
Summary: RemoteInterpreter patch to run on win32
Initial Comment:
*** ../Tools/idlefork-0.8.1/RemoteInterp.py Thu
Jul 12 17:06:22 2001
--- ../Tools/idlenew/RemoteInterp.py Wed Aug 15
15:05:10 2001
***************
*** 121,127 ****
def _decode_msg(self, msg):
seqno = self.decode_seqno(msg
[:self.SEQNO_ENC_LEN])
msg = msg[self.SEQNO_ENC_LEN:]
! parts = msg.split(" ", 2)
if len(parts) == 1:
cmd = msg
arg = ''
--- 121,131 ----
def _decode_msg(self, msg):
seqno = self.decode_seqno(msg
[:self.SEQNO_ENC_LEN])
msg = msg[self.SEQNO_ENC_LEN:]
! #
! # split a message into two parts
! # cmd <space> arg
! #
! parts = msg.split(" ", 1)
if len(parts) == 1:
cmd = msg
arg = ''
***************
*** 263,280 ****
self._cmd.reply()
self._cmd.close()
def startRemoteInterp(id):
import os
# UNIX domain sockets are simpler for starters
sock = socket.socket(socket.AF_UNIX,
socket.SOCK_STREAM)
! sock.bind("/var/tmp/ri.%s" % id)
try:
sock.listen(1)
cli, addr = sock.accept()
rinterp = RemoteInterp(cli)
rinterp.run()
finally:
! os.unlink("/var/tmp/ri.%s" % id)
class RIClient:
"""Client of the remote interpreter"""
--- 267,299 ----
self._cmd.reply()
self._cmd.close()
+ def getAddress(id):
+ """returns a string representing the address of
the
+ Unix domain socket for a particular id"""
+ import tempfile
+ import os
+ if tempfile.tempdir:
+ filename = os.path.join
(tempfile.tempdir, "rs.%s" % id)
+ else:
+ #
+ # no temp dir defined in environment, use the
+ # current directory.
+ #
+ filename = "rs.%s" % id
+ return filename
+
def startRemoteInterp(id):
import os
# UNIX domain sockets are simpler for starters
sock = socket.socket(socket.AF_UNIX,
socket.SOCK_STREAM)
! sock.bind( getAddress(id) )
try:
sock.listen(1)
cli, addr = sock.accept()
rinterp = RemoteInterp(cli)
rinterp.run()
finally:
! os.unlink( getAddress(id) )
class RIClient:
"""Client of the remote interpreter"""
***************
*** 317,328 ****
def riExec(id, file):
sock = socket.socket(socket.AF_UNIX,
socket.SOCK_STREAM)
! sock.connect("/var/tmp/ri.%s" % id)
cli = RIClient(sock)
cli.execfile(file)
cli.run()
if __name__ == "__main__":
import sys
import getopt
--- 336,360 ----
def riExec(id, file):
sock = socket.socket(socket.AF_UNIX,
socket.SOCK_STREAM)
! sock.connect(getAddress(id))
cli = RIClient(sock)
cli.execfile(file)
cli.run()
if __name__ == "__main__":
+
+ # Usage:
+ # python RemoteInterp.py [-c] [-v] id
+ # Options:
+ # -c run as a client. Otherwise, run as a
server by default
+ # -v verbose mode
+ # Example:
+ # This starts the server:
+ # python RemoteInterp.py id123
+ #
+ # This starts the client:
+ # python RemoteInterp.py -c id123 test.py
+ #
import sys
import getopt
----------------------------------------------------------------------
>Comment By: Stephen M. Gava (elguavas)
Date: 2001-10-07 19:56
Message:
Logged In: YES
user_id=75867
this will have to wait until I can get someone to work on
the remote execution aspects of idle fork. if that has to be
me then it won't be for some time.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=309579&aid=451088&group_id=9
579