2004-07-18 03:16:08 -03:00
|
|
|
"""Build a "big" applet for the IDE, and put it in the Python home
|
1999-02-02 18:27:41 -04:00
|
|
|
directory. It will contain all IDE-specific modules as PYC resources,
|
|
|
|
which reduces the startup time (especially on slower machines)."""
|
|
|
|
|
1999-01-30 18:39:17 -04:00
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import buildtools
|
2001-08-25 09:15:04 -03:00
|
|
|
from Carbon import Res
|
1999-01-30 18:39:17 -04:00
|
|
|
import py_resource
|
|
|
|
|
|
|
|
buildtools.DEBUG=1
|
|
|
|
|
|
|
|
template = buildtools.findtemplate()
|
|
|
|
|
|
|
|
ide_home = os.path.join(sys.exec_prefix, ":Mac:Tools:IDE")
|
|
|
|
|
|
|
|
mainfilename = os.path.join(ide_home, "PythonIDE.py")
|
|
|
|
dstfilename = os.path.join(sys.exec_prefix, "Python IDE")
|
|
|
|
|
|
|
|
buildtools.process(template, mainfilename, dstfilename, 1)
|
|
|
|
|
2000-06-20 18:59:25 -03:00
|
|
|
targetref = Res.FSpOpenResFile(dstfilename, 3)
|
1999-01-30 18:39:17 -04:00
|
|
|
Res.UseResFile(targetref)
|
|
|
|
|
|
|
|
files = os.listdir(ide_home)
|
|
|
|
|
1999-02-02 18:27:41 -04:00
|
|
|
# skip this script and the main program
|
2004-07-18 03:16:08 -03:00
|
|
|
files = filter(lambda x: x[-3:] == '.py' and
|
|
|
|
x not in ("BuildIDE.py", "PythonIDE.py"), files)
|
1999-01-30 18:39:17 -04:00
|
|
|
|
1999-02-02 18:27:41 -04:00
|
|
|
# add the modules as PYC resources
|
1999-01-30 18:39:17 -04:00
|
|
|
for name in files:
|
2004-07-18 03:16:08 -03:00
|
|
|
print "adding", name
|
|
|
|
fullpath = os.path.join(ide_home, name)
|
|
|
|
id, name = py_resource.frompyfile(fullpath, name[:-3], preload=1,
|
|
|
|
ispackage=0)
|
1999-01-30 18:39:17 -04:00
|
|
|
|
1999-02-02 18:27:41 -04:00
|
|
|
# add W resources
|
2000-06-20 18:59:25 -03:00
|
|
|
wresref = Res.FSpOpenResFile(os.path.join(ide_home, "Widgets.rsrc"), 1)
|
1999-01-30 18:39:17 -04:00
|
|
|
buildtools.copyres(wresref, targetref, [], 0)
|