Mercurial > cpython-lru_cache-weakref
annotate Mac/Tools/IDE/BuildIDE.py @ 25838:8540887bcec6 2.2
Backport of 2.183:
Fix memory leak in add_subclass() found by NealN with valgrind.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 18 Oct 2002 13:42:21 +0000 |
| parents | 42b2f1936254 |
| children | c3a096bfbd6b |
| rev | line source |
|---|---|
|
10086
c7144e7e8494
added some comments
Just van Rossum <just@lettererror.com>
parents:
10047
diff
changeset
|
1 """Build a "big" applet for the IDE, and put it in the Python home |
|
c7144e7e8494
added some comments
Just van Rossum <just@lettererror.com>
parents:
10047
diff
changeset
|
2 directory. It will contain all IDE-specific modules as PYC resources, |
|
c7144e7e8494
added some comments
Just van Rossum <just@lettererror.com>
parents:
10047
diff
changeset
|
3 which reduces the startup time (especially on slower machines).""" |
|
c7144e7e8494
added some comments
Just van Rossum <just@lettererror.com>
parents:
10047
diff
changeset
|
4 |
| 10047 | 5 import sys |
| 6 import os | |
| 7 import buildtools | |
|
19488
42b2f1936254
Import the MacOS toolbox modules from the Carbon package.
Jack Jansen <jack.jansen@cwi.nl>
parents:
12972
diff
changeset
|
8 from Carbon import Res |
| 10047 | 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 | |
|
12972
fc77e34ef274
Replaced OpenResFile calls with FSpOpenResFile calls (which are carbon-compatible).
Jack Jansen <jack.jansen@cwi.nl>
parents:
10319
diff
changeset
|
22 targetref = Res.FSpOpenResFile(dstfilename, 3) |
| 10047 | 23 Res.UseResFile(targetref) |
| 24 | |
| 25 files = os.listdir(ide_home) | |
| 26 | |
|
10086
c7144e7e8494
added some comments
Just van Rossum <just@lettererror.com>
parents:
10047
diff
changeset
|
27 # skip this script and the main program |
|
c7144e7e8494
added some comments
Just van Rossum <just@lettererror.com>
parents:
10047
diff
changeset
|
28 files = filter(lambda x: x[-3:] == '.py' and |
|
c7144e7e8494
added some comments
Just van Rossum <just@lettererror.com>
parents:
10047
diff
changeset
|
29 x not in ("BuildIDE.py", "PythonIDE.py"), files) |
| 10047 | 30 |
|
10086
c7144e7e8494
added some comments
Just van Rossum <just@lettererror.com>
parents:
10047
diff
changeset
|
31 # add the modules as PYC resources |
| 10047 | 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 | |
|
10086
c7144e7e8494
added some comments
Just van Rossum <just@lettererror.com>
parents:
10047
diff
changeset
|
38 # add W resources |
|
12972
fc77e34ef274
Replaced OpenResFile calls with FSpOpenResFile calls (which are carbon-compatible).
Jack Jansen <jack.jansen@cwi.nl>
parents:
10319
diff
changeset
|
39 wresref = Res.FSpOpenResFile(os.path.join(ide_home, "Widgets.rsrc"), 1) |
| 10047 | 40 buildtools.copyres(wresref, targetref, [], 0) |
|
10086
c7144e7e8494
added some comments
Just van Rossum <just@lettererror.com>
parents:
10047
diff
changeset
|
41 |
