/[cvs]/nfo/projects/mess/src/client/windows/build.py
ViewVC logotype

Annotation of /nfo/projects/mess/src/client/windows/build.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Sat Jun 3 23:08:53 2006 UTC (18 years, 3 months ago) by joko
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/x-python
+ initial commit: try py2exe

1 joko 1.1 # This setup script builds a single-file Python inprocess COM server.
2     #
3    
4     # ModuleFinder can't handle runtime changes to __path__, but win32com uses them
5     # see http://starship.python.net/crew/theller/moin.cgi/WinShell
6     import sys
7     try:
8     import modulefinder
9     import win32com
10     for p in win32com.__path__[1:]:
11     modulefinder.AddPackagePath("win32com", p)
12     for extra in ["win32com.shell"]: #,"win32com.mapi"
13     __import__(extra)
14     m = sys.modules[extra]
15     for p in m.__path__[1:]:
16     modulefinder.AddPackagePath(extra, p)
17     except ImportError:
18     # no build path setup, no worries.
19     pass
20    
21    
22     # regular startup of build.py
23     # from Python24\Lib\site-packages\py2exe\samples\singlefile\comserver\setup.py
24     from distutils.core import setup
25     import py2exe
26     import sys
27    
28     # If run without args, build executables, in quiet mode.
29     if len(sys.argv) == 1:
30     sys.argv.append("py2exe")
31     sys.argv.append("-q")
32    
33     class Target:
34     def __init__(self, **kw):
35     self.__dict__.update(kw)
36     # for the versioninfo resources
37     self.version = "0.6.0"
38     self.company_name = "No Company"
39     self.copyright = "no copyright"
40     self.name = "py2exe sample files"
41    
42     ################################################################
43     # a COM server dll, modules is required
44     #
45    
46     interp = Target(
47     description = "Mess Shell Extension",
48     # what to build. For COM servers, the module name (not the
49     # filename) must be specified!
50     #modules = ["win32com.servers.interp"],
51     modules = ["context_menu"],
52     # we only want the inproc server.
53     create_exe = False,
54     )
55    
56    
57     ################################################################
58     # pywin32 COM pulls in a lot of stuff which we don't want or need.
59    
60     excludes = ["pywin", "pywin.debugger", "pywin.debugger.dbgcon",
61     "pywin.dialogs", "pywin.dialogs.list", "win32com.client"]
62    
63     options = {
64     "bundle_files": 1, # create singlefile exe
65     "compressed": 1, # compress the library archive
66     "excludes": excludes,
67     "dll_excludes": ["w9xpopen.exe"] # we don't need this
68     }
69    
70     setup(
71     options = {"py2exe": options},
72     zipfile = None, # append zip-archive to the executable.
73     #console = ["context_menu.py"]
74     com_server = [interp]
75     )

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed