File: BuildIDE.py

package info (click to toggle)
python2.3 2.3.5-3sarge2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 43,908 kB
  • ctags: 81,384
  • sloc: ansic: 266,250; python: 246,028; makefile: 4,194; perl: 3,702; lisp: 3,630; sh: 2,576; xml: 1,601; objc: 740; cpp: 106; sed: 2
file content (41 lines) | stat: -rw-r--r-- 1,158 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""Build a "big" applet for the IDE, and put it in the Python home 
directory. It will contain all IDE-specific modules as PYC resources,
which reduces the startup time (especially on slower machines)."""

import sys
import os
import buildtools
from Carbon import Res
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)

targetref = Res.FSpOpenResFile(dstfilename, 3)
Res.UseResFile(targetref)

files = os.listdir(ide_home)

# skip this script and the main program
files = filter(lambda x: x[-3:] == '.py' and 
		x not in ("BuildIDE.py", "PythonIDE.py"), files)

# add the modules as PYC resources
for name in files:
	print "adding", name
	fullpath = os.path.join(ide_home, name)
	id, name = py_resource.frompyfile(fullpath, name[:-3], preload=1,
		ispackage=0)

# add W resources
wresref = Res.FSpOpenResFile(os.path.join(ide_home, "Widgets.rsrc"), 1)
buildtools.copyres(wresref, targetref, [], 0)