blob: 7e6586930a5cd45b2f123f87f14eac454dd72883 [file] [log] [blame]
Just van Rossumb8bf1631999-02-02 22:27:41 +00001"""Build a "big" applet for the IDE, and put it in the Python home
2directory. It will contain all IDE-specific modules as PYC resources,
3which reduces the startup time (especially on slower machines)."""
4
Just van Rossum40f9b7b1999-01-30 22:39:17 +00005import sys
6import os
7import buildtools
Jack Jansen5a6fdcd2001-08-25 12:15:04 +00008from Carbon import Res
Just van Rossum40f9b7b1999-01-30 22:39:17 +00009import py_resource
10
11buildtools.DEBUG=1
12
13template = buildtools.findtemplate()
14
15ide_home = os.path.join(sys.exec_prefix, ":Mac:Tools:IDE")
16
17mainfilename = os.path.join(ide_home, "PythonIDE.py")
18dstfilename = os.path.join(sys.exec_prefix, "Python IDE")
19
20buildtools.process(template, mainfilename, dstfilename, 1)
21
Jack Jansend13c3852000-06-20 21:59:25 +000022targetref = Res.FSpOpenResFile(dstfilename, 3)
Just van Rossum40f9b7b1999-01-30 22:39:17 +000023Res.UseResFile(targetref)
24
25files = os.listdir(ide_home)
26
Just van Rossumb8bf1631999-02-02 22:27:41 +000027# skip this script and the main program
28files = filter(lambda x: x[-3:] == '.py' and
29 x not in ("BuildIDE.py", "PythonIDE.py"), files)
Just van Rossum40f9b7b1999-01-30 22:39:17 +000030
Just van Rossumb8bf1631999-02-02 22:27:41 +000031# add the modules as PYC resources
Just van Rossum40f9b7b1999-01-30 22:39:17 +000032for 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)
37
Just van Rossumb8bf1631999-02-02 22:27:41 +000038# add W resources
Jack Jansend13c3852000-06-20 21:59:25 +000039wresref = Res.FSpOpenResFile(os.path.join(ide_home, "Widgets.rsrc"), 1)
Just van Rossum40f9b7b1999-01-30 22:39:17 +000040buildtools.copyres(wresref, targetref, [], 0)
Just van Rossumb8bf1631999-02-02 22:27:41 +000041