From: Mark H. <mha...@us...> - 2006-07-02 11:15:21
|
Update of /cvsroot/py2exe/py2exe/py2exe/samples/pywin32/com_server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21569/pywin32/com_server Added Files: README.txt setup.py test_interp.py test_interp.vbs Log Message: Finally commit some samples I've had hanging around forever. --- NEW FILE: setup.py --- # setup_interp.py # A distutils setup script for the "interp" sample. from distutils.core import setup import py2exe # Don't pull in all this MFC stuff used by the makepy UI. py2exe_options = dict(excludes="pywin,pywin.dialogs,pywin.dialogs.list,win32ui") setup(name="win32com 'interp' sample", com_server=["win32com.servers.interp"], options = dict(py2exe=py2exe_options) ) --- NEW FILE: test_interp.vbs --- rem A VBScript program that uses the py2exe created COM object. rem Register the object (see README.txt), then execute: rem cscript.exe test_interp.vbs set interp = CreateObject("Python.Interpreter") interp.Exec "import sys" WScript.Echo("The COM object is being hosted in " & interp.Eval("sys.executable")) WScript.Echo("Path is:" & interp.Eval("str(sys.path)")) --- NEW FILE: README.txt --- This is a sample of a COM object ('server') implemented in Python. This builds the pywin32 sample COM object 'interp' - see the win32com\servers directory. Execute: setup.py py2exe And in the dist directory you will find interp.exe and inter.dll. You can register the objects with 'interp.exe /regserver' or 'regsvr32 interp.dll'. 'interp.exe /unregister' and 'regsvr32 /u interp.dll' will unregister the objects. Once registered, test the object using 'test_interp.py' or 'test_interp.vbs' --- NEW FILE: test_interp.py --- # A Python program that uses our binaries! # (Note that this is *not* transformed into a .exe - its an example consumer # of our object, not part of our object) from win32com.client import Dispatch import pprint interp = Dispatch("Python.Interpreter") interp.Exec("import sys") print "The COM object is being hosted in ", interp.Eval("sys.executable") print "Path is:", interp.Eval("sys.path") |