blob: bb06d190272a2f9af746769507b584c6e4df1920 [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 Jansenf04fa721996-04-10 14:51:14 +000016import EasyDialogs
Jack Jansen6655c4e1995-09-01 12:03:32 +000017
18import addpack
Jack Jansen6655c4e1995-09-01 12:03:32 +000019import aetools
Jack Jansen1023dff1996-02-21 15:28:49 +000020import AppleEvents
Jack Jansen6655c4e1995-09-01 12:03:32 +000021from Metrowerks_Shell_Suite import Metrowerks_Shell_Suite
22from Required_Suite import Required_Suite
23
24addpack.addpack('Mac')
25addpack.addpack('scripts')
26import mkapplet
27
28class MwShell(aetools.TalkTo, Metrowerks_Shell_Suite, Required_Suite):
29 pass
30
Jack Jansenf04fa721996-04-10 14:51:14 +000031RUNNING=[]
Jack Jansen6655c4e1995-09-01 12:03:32 +000032
33def buildmwproject(top, creator, projects):
34 """Build projects with an MW compiler"""
Jack Jansenb9e5e141996-09-20 15:30:52 +000035 mgr = MwShell(creator, start=1)
Jack Jansen1023dff1996-02-21 15:28:49 +000036 mgr.send_timeout = AppleEvents.kNoTimeOut
37
Jack Jansen6655c4e1995-09-01 12:03:32 +000038 for file in projects:
39 file = os.path.join(top, file)
40 fss = macfs.FSSpec(file)
41 print 'Building', file
42 mgr.open(fss)
Jack Jansen1023dff1996-02-21 15:28:49 +000043 try:
44 mgr.Make_Project()
Jack Jansenb9e5e141996-09-20 15:30:52 +000045 except aetools.Error, arg:
46 print '** Failed:', arg
Jack Jansen6655c4e1995-09-01 12:03:32 +000047 mgr.Close_Project()
Jack Jansenf04fa721996-04-10 14:51:14 +000048## mgr.quit()
Jack Jansen6655c4e1995-09-01 12:03:32 +000049
50def buildapplet(top, dummy, list):
51 """Create a PPC python applet"""
52 template = mkapplet.findtemplate()
53 for src in list:
54 if src[-3:] != '.py':
55 raise 'Should end in .py', src
56 base = os.path.basename(src)
57 dst = os.path.join(top, base)[:-3]
58 src = os.path.join(top, src)
59 try:
60 os.unlink(dst)
61 except os.error:
62 pass
63 print 'Building applet', dst
64 mkapplet.process(template, src, dst)
65
66#
67# The build instructions. Entries are (routine, arg, list-of-files)
68# XXXX We could also include the builds for stdwin and such here...
Jack Jansenf04fa721996-04-10 14:51:14 +000069PPC_INSTRUCTIONS=[
Jack Jansenb39a5d71995-10-09 23:19:30 +000070 (buildmwproject, "CWIE", [
Jack Jansen05797151996-08-23 15:52:56 +000071 ":build.macppc.shared:PythonCorePPC.µ",
Jack Jansen6655c4e1995-09-01 12:03:32 +000072 ":build.macppc.shared:PythonPPC.µ",
Jack Jansen05797151996-08-23 15:52:56 +000073 ":build.macppc.shared:PythonAppletPPC.µ",
Jack Jansenf04fa721996-04-10 14:51:14 +000074 ])
75]
Jack Jansen25b361f1996-08-20 16:35:30 +000076CFM68K_INSTRUCTIONS=[
77 (buildmwproject, "CWIE", [
78 ":build.mac68k.shared:PythonCoreCFM68K.µ",
79 ":build.mac68k.shared:PythonCFM68K.µ",
80 ":build.mac68k.shared:PythonAppletCFM68K.µ",
81 ])
82]
Jack Jansen05797151996-08-23 15:52:56 +000083FAT_INSTRUCTIONS=[
84 (buildmwproject, "CWIE", [
85 ":build.macppc.shared:Python.µ",
86 ":build.macppc.shared:PythonApplet.µ",
87 ])
88]
Jack Jansenf04fa721996-04-10 14:51:14 +000089PLUGIN_INSTRUCTIONS=[
90 (buildmwproject, "CWIE", [
Jack Jansen05797151996-08-23 15:52:56 +000091 ":PlugIns:ctb.ppc.µ",
Jack Jansen25b361f1996-08-20 16:35:30 +000092 ":PlugIns:imgmodules.ppc.µ",
Jack Jansen05797151996-08-23 15:52:56 +000093 ":PlugIns:macspeech.ppc.µ",
Jack Jansen25b361f1996-08-20 16:35:30 +000094 ":PlugIns:toolboxmodules.ppc.µ",
Jack Jansen05797151996-08-23 15:52:56 +000095 ":PlugIns:qtmodules.ppc.µ",
96 ":PlugIns:waste.ppc.µ",
97 ":PlugIns:_tkinter.ppc.µ",
Jack Jansen25b361f1996-08-20 16:35:30 +000098 ])
99]
100CFM68KPLUGIN_INSTRUCTIONS=[
101 (buildmwproject, "CWIE", [
Jack Jansen05797151996-08-23 15:52:56 +0000102 ":PlugIns:ctb.CFM68K.µ",
103 ":PlugIns:imgmodules.ppc.µ",
Jack Jansen25b361f1996-08-20 16:35:30 +0000104 ":PlugIns:toolboxmodules.CFM68K.µ",
Jack Jansen05797151996-08-23 15:52:56 +0000105 ":PlugIns:qtmodules.CFM68K.µ",
106 ":PlugIns:waste.CFM68K.µ",
107 ":PlugIns:_tkinter.CFM68K.µ",
Jack Jansenf04fa721996-04-10 14:51:14 +0000108 ])
109]
110M68K_INSTRUCTIONS=[
111 (buildmwproject, "CWIE", [
Jack Jansen6655c4e1995-09-01 12:03:32 +0000112 ":build.mac68k.stand:Python68K.µ",
Jack Jansenf04fa721996-04-10 14:51:14 +0000113 ])
114]
Jack Jansen05797151996-08-23 15:52:56 +0000115PPCSTAND_INSTRUCTIONS=[
116 (buildmwproject, "CWIE", [
117 ":build.macppc.stand:PythonStandalone.µ",
118 ])
119]
Jack Jansenf04fa721996-04-10 14:51:14 +0000120APPLET_INSTRUCTIONS=[
Jack Jansen6655c4e1995-09-01 12:03:32 +0000121 (buildapplet, None, [
122 ":Mac:scripts:EditPythonPrefs.py",
123 ":Mac:scripts:mkapplet.py",
Jack Jansenb39a5d71995-10-09 23:19:30 +0000124 ":Mac:scripts:MkPluginAliases.py"
Jack Jansen6655c4e1995-09-01 12:03:32 +0000125 ])
126]
Jack Jansenf04fa721996-04-10 14:51:14 +0000127
128ALLINST=[
129 ("PPC shared executable", PPC_INSTRUCTIONS),
130 ("PPC plugin modules", PLUGIN_INSTRUCTIONS),
Jack Jansen25b361f1996-08-20 16:35:30 +0000131 ("CFM68K shared executable", CFM68K_INSTRUCTIONS),
Jack Jansen05797151996-08-23 15:52:56 +0000132 ("CFM68K plugin modules", CFM68KPLUGIN_INSTRUCTIONS),
133 ("FAT shared executables", FAT_INSTRUCTIONS),
Jack Jansen25b361f1996-08-20 16:35:30 +0000134 ("68K standalone executable", M68K_INSTRUCTIONS),
Jack Jansen05797151996-08-23 15:52:56 +0000135 ("PPC standalone executable", PPCSTAND_INSTRUCTIONS),
Jack Jansen25b361f1996-08-20 16:35:30 +0000136 ("Applets", APPLET_INSTRUCTIONS)
Jack Jansenf04fa721996-04-10 14:51:14 +0000137]
Jack Jansen6655c4e1995-09-01 12:03:32 +0000138
139def main():
140 dir, ok = macfs.GetDirectory('Python source folder:')
141 if not ok:
142 sys.exit(0)
143 dir = dir.as_pathname()
Jack Jansenf04fa721996-04-10 14:51:14 +0000144 INSTRUCTIONS = []
145 for string, inst in ALLINST:
146 answer = EasyDialogs.AskYesNoCancel("Build %s?"%string, 1)
147 if answer < 0:
148 sys.exit(0)
149 if answer:
150 INSTRUCTIONS = INSTRUCTIONS + inst
Jack Jansen6655c4e1995-09-01 12:03:32 +0000151 for routine, arg, list in INSTRUCTIONS:
152 routine(dir, arg, list)
153 print "All done!"
154 sys.exit(1)
155
156if __name__ == '__main__':
157 main()
158