[Idle-dev] [ idlefork-Patches-451088 ] RemoteInterpreter patch to run on win32
noreply@sourceforge.net
noreply@sourceforge.net
Sun, 22 Sep 2002 17:58:13 -0700
Patches item #451088, was opened at 2001-08-15 02:01
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=309579&aid=451088&group_id=9579
Category: None
Group: None
>Status: Closed
>Resolution: Out of Date
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: Kurt B. Kaiser (kbk)
Date: 2002-09-22 19:58
Message:
Logged In: YES
user_id=149084
RemoteInterpreter module has been
eliminated from the current version
of Idle running GvR RPC.
Revisit patch code if there is a problem
running GRPC on Windows. Close
for now.
----------------------------------------------------------------------
Comment By: Stephen M. Gava (elguavas)
Date: 2001-10-07 21: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:
https://sourceforge.net/tracker/?func=detail&atid=309579&aid=451088&group_id=9579