Update of /cvsroot/pywin32/pywin32/com/win32com/test
In directory sc8-pr-cvs1:/tmp/cvs-serv28423
Modified Files:
util.py
Log Message:
Utility function for registering a Python server.
Index: util.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/util.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** util.py 18 Nov 2002 11:20:07 -0000 1.2
--- util.py 23 Oct 2003 07:05:46 -0000 1.3
***************
*** 1,4 ****
! import sys
! import string
from pythoncom import _GetInterfaceCount, _GetGatewayCount
--- 1,4 ----
! import sys, os
! import win32api
from pythoncom import _GetInterfaceCount, _GetGatewayCount
***************
*** 14,17 ****
--- 14,26 ----
print "Warning - %d com gateway objects still alive" % c
+ def RegisterPythonServer(filename, verbose=0):
+ cmd = '%s "%s" > nul' % (win32api.GetModuleFileName(0), filename)
+ if verbose:
+ print "Registering engine", filename
+ # print cmd
+ rc = os.system(cmd)
+ if rc:
+ raise RuntimeError, "Registration of engine '%s' failed" % filename
+
class CaptureWriter:
def __init__(self):
***************
*** 31,35 ****
self.captured.append(msg)
def get_captured(self):
! return string.join(self.captured,"")
def get_num_lines_captured(self):
! return len(string.split(string.join(self.captured, ""),"\n"))
--- 40,44 ----
self.captured.append(msg)
def get_captured(self):
! return "".join(self.captured)
def get_num_lines_captured(self):
! return len("".join(self.captured).split("\n"))
|