Just van Rossum | b8bf163 | 1999-02-02 22:27:41 +0000 | [diff] [blame] | 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).""" |
| 4 | |
Just van Rossum | 40f9b7b | 1999-01-30 22:39:17 +0000 | [diff] [blame] | 5 | import sys |
| 6 | import os |
| 7 | import buildtools |
| 8 | import Res |
| 9 | import py_resource |
| 10 | |
| 11 | buildtools.DEBUG=1 |
| 12 | |
| 13 | template = buildtools.findtemplate() |
| 14 | |
| 15 | ide_home = os.path.join(sys.exec_prefix, ":Mac:Tools:IDE") |
| 16 | |
| 17 | mainfilename = os.path.join(ide_home, "PythonIDE.py") |
| 18 | dstfilename = os.path.join(sys.exec_prefix, "Python IDE") |
| 19 | |
| 20 | buildtools.process(template, mainfilename, dstfilename, 1) |
| 21 | |
| 22 | targetref = Res.OpenResFile(dstfilename) |
| 23 | Res.UseResFile(targetref) |
| 24 | |
| 25 | files = os.listdir(ide_home) |
| 26 | |
Just van Rossum | b8bf163 | 1999-02-02 22:27:41 +0000 | [diff] [blame] | 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) |
Just van Rossum | 40f9b7b | 1999-01-30 22:39:17 +0000 | [diff] [blame] | 30 | |
Just van Rossum | b8bf163 | 1999-02-02 22:27:41 +0000 | [diff] [blame] | 31 | # add the modules as PYC resources |
Just van Rossum | 40f9b7b | 1999-01-30 22:39:17 +0000 | [diff] [blame] | 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) |
| 37 | |
Just van Rossum | b8bf163 | 1999-02-02 22:27:41 +0000 | [diff] [blame] | 38 | # add W resources |
Just van Rossum | 40f9b7b | 1999-01-30 22:39:17 +0000 | [diff] [blame] | 39 | wresref = Res.OpenResFile(os.path.join(ide_home, "Widgets.rsrc")) |
| 40 | buildtools.copyres(wresref, targetref, [], 0) |
Just van Rossum | b8bf163 | 1999-02-02 22:27:41 +0000 | [diff] [blame] | 41 | |