Add forgotten initialization. Fixes bug #120994, "Traceback with
[python/dscho.git] / Mac / Tools / IDE / BuildIDE.py
blob942670acfc49de57e52ade316aca6c992149e37d
1 """Build a "big" applet for the IDE, and put it in the Python home
2 directory. It will contain all IDE-specific modules as PYC resources,
3 which reduces the startup time (especially on slower machines)."""
5 import sys
6 import os
7 import buildtools
8 import Res
9 import py_resource
11 buildtools.DEBUG=1
13 template = buildtools.findtemplate()
15 ide_home = os.path.join(sys.exec_prefix, ":Mac:Tools:IDE")
17 mainfilename = os.path.join(ide_home, "PythonIDE.py")
18 dstfilename = os.path.join(sys.exec_prefix, "Python IDE")
20 buildtools.process(template, mainfilename, dstfilename, 1)
22 targetref = Res.FSpOpenResFile(dstfilename, 3)
23 Res.UseResFile(targetref)
25 files = os.listdir(ide_home)
27 # skip this script and the main program
28 files = filter(lambda x: x[-3:] == '.py' and
29 x not in ("BuildIDE.py", "PythonIDE.py"), files)
31 # add the modules as PYC resources
32 for name in files:
33 print "adding", name
34 fullpath = os.path.join(ide_home, name)
35 id, name = py_resource.frompyfile(fullpath, name[:-3], preload=1,
36 ispackage=0)
38 # add W resources
39 wresref = Res.FSpOpenResFile(os.path.join(ide_home, "Widgets.rsrc"), 1)
40 buildtools.copyres(wresref, targetref, [], 0)