blob: 3c9eead499b36bd0e2bf284fe0b8b607b9c57762 [file] [log] [blame]
Jack Jansen6655c4e1995-09-01 12:03:32 +00001#
2# fullbuild creates everything that needs to be created before a
3# distribution can be made, and puts it all in the right place.
4#
5# It expects the projects to be in the places where Jack likes them:
6# in directories named like 'build.macppc.shared'. That is fixable,
7# however.
8#
9# NOTE: You should proably make a copy of python with which to execute this
10# script, rebuilding running programs does not work...
11
12import os
13import sys
14import macfs
Jack Jansen1023dff1996-02-21 15:28:49 +000015import MacOS
Jack Jansen6655c4e1995-09-01 12:03:32 +000016
17import addpack
18addpack.addpack('Tools')
19addpack.addpack('bgen')
20addpack.addpack('AE')
21import aetools
Jack Jansen1023dff1996-02-21 15:28:49 +000022import AppleEvents
Jack Jansen6655c4e1995-09-01 12:03:32 +000023from Metrowerks_Shell_Suite import Metrowerks_Shell_Suite
24from Required_Suite import Required_Suite
25
26addpack.addpack('Mac')
27addpack.addpack('scripts')
28import mkapplet
29
30class MwShell(aetools.TalkTo, Metrowerks_Shell_Suite, Required_Suite):
31 pass
32
33
34def buildmwproject(top, creator, projects):
35 """Build projects with an MW compiler"""
36 print 'Please start project mgr with signature', creator,'-'
37 sys.stdin.readline()
38 try:
39 mgr = MwShell(creator)
40 except 'foo':
41 print 'Not handled:', creator
42 return
Jack Jansen1023dff1996-02-21 15:28:49 +000043 mgr.send_timeout = AppleEvents.kNoTimeOut
44
Jack Jansen6655c4e1995-09-01 12:03:32 +000045 for file in projects:
46 file = os.path.join(top, file)
47 fss = macfs.FSSpec(file)
48 print 'Building', file
49 mgr.open(fss)
Jack Jansen1023dff1996-02-21 15:28:49 +000050 try:
51 mgr.Make_Project()
52 except MacOS.Error, arg:
53 print '** Failed. Possible error:', arg
Jack Jansen6655c4e1995-09-01 12:03:32 +000054 mgr.Close_Project()
55 mgr.quit()
56
57def buildapplet(top, dummy, list):
58 """Create a PPC python applet"""
59 template = mkapplet.findtemplate()
60 for src in list:
61 if src[-3:] != '.py':
62 raise 'Should end in .py', src
63 base = os.path.basename(src)
64 dst = os.path.join(top, base)[:-3]
65 src = os.path.join(top, src)
66 try:
67 os.unlink(dst)
68 except os.error:
69 pass
70 print 'Building applet', dst
71 mkapplet.process(template, src, dst)
72
73#
74# The build instructions. Entries are (routine, arg, list-of-files)
75# XXXX We could also include the builds for stdwin and such here...
76INSTRUCTIONS=[
Jack Jansenb39a5d71995-10-09 23:19:30 +000077 (buildmwproject, "CWIE", [
Jack Jansen6655c4e1995-09-01 12:03:32 +000078 ":build.macppc.shared:PythonCore.µ",
79 ":build.macppc.shared:PythonPPC.µ",
80 ":build.macppc.shared:PythonApplet.µ",
81
82 ":PlugIns:ctbmodule.µ",
83 ":PlugIns:imgmodules.µ",
84 ":PlugIns:macspeechmodule.µ",
85 ":PlugIns:mactcpmodules.µ",
86 ":PlugIns:stdwinmodule.µ",
87 ":PlugIns:toolboxmodules.µ",
Jack Jansenb39a5d71995-10-09 23:19:30 +000088
Jack Jansen6655c4e1995-09-01 12:03:32 +000089 ":build.mac68k.stand:Python68K.µ",
90 ]),
91 (buildapplet, None, [
92 ":Mac:scripts:EditPythonPrefs.py",
93 ":Mac:scripts:mkapplet.py",
Jack Jansenb39a5d71995-10-09 23:19:30 +000094 ":Mac:scripts:RunLibScript.py",
95 ":Mac:scripts:MkPluginAliases.py"
Jack Jansen6655c4e1995-09-01 12:03:32 +000096 ])
97]
98
99def main():
100 dir, ok = macfs.GetDirectory('Python source folder:')
101 if not ok:
102 sys.exit(0)
103 dir = dir.as_pathname()
104 for routine, arg, list in INSTRUCTIONS:
105 routine(dir, arg, list)
106 print "All done!"
107 sys.exit(1)
108
109if __name__ == '__main__':
110 main()
111