blob: 378049c9a3a94de84bf695a1e4a05c2a9a98df34 [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
Jack Jansen6655c4e1995-09-01 12:03:32 +000024import mkapplet
25
26class MwShell(aetools.TalkTo, Metrowerks_Shell_Suite, Required_Suite):
27 pass
28
Jack Jansenf04fa721996-04-10 14:51:14 +000029RUNNING=[]
Jack Jansen6655c4e1995-09-01 12:03:32 +000030
31def buildmwproject(top, creator, projects):
32 """Build projects with an MW compiler"""
Jack Jansenb9e5e141996-09-20 15:30:52 +000033 mgr = MwShell(creator, start=1)
Jack Jansen1023dff1996-02-21 15:28:49 +000034 mgr.send_timeout = AppleEvents.kNoTimeOut
35
Jack Jansen6655c4e1995-09-01 12:03:32 +000036 for file in projects:
37 file = os.path.join(top, file)
38 fss = macfs.FSSpec(file)
39 print 'Building', file
40 mgr.open(fss)
Jack Jansen1023dff1996-02-21 15:28:49 +000041 try:
42 mgr.Make_Project()
Jack Jansenb9e5e141996-09-20 15:30:52 +000043 except aetools.Error, arg:
44 print '** Failed:', arg
Jack Jansen6655c4e1995-09-01 12:03:32 +000045 mgr.Close_Project()
Jack Jansenf04fa721996-04-10 14:51:14 +000046## mgr.quit()
Jack Jansen6655c4e1995-09-01 12:03:32 +000047
48def buildapplet(top, dummy, list):
49 """Create a PPC python applet"""
50 template = mkapplet.findtemplate()
51 for src in list:
52 if src[-3:] != '.py':
53 raise 'Should end in .py', src
54 base = os.path.basename(src)
55 dst = os.path.join(top, base)[:-3]
56 src = os.path.join(top, src)
57 try:
58 os.unlink(dst)
59 except os.error:
60 pass
61 print 'Building applet', dst
62 mkapplet.process(template, src, dst)
63
64#
65# The build instructions. Entries are (routine, arg, list-of-files)
66# XXXX We could also include the builds for stdwin and such here...
Jack Jansenf04fa721996-04-10 14:51:14 +000067PPC_INSTRUCTIONS=[
Jack Jansenb39a5d71995-10-09 23:19:30 +000068 (buildmwproject, "CWIE", [
Jack Jansen05797151996-08-23 15:52:56 +000069 ":build.macppc.shared:PythonCorePPC.µ",
Jack Jansen6655c4e1995-09-01 12:03:32 +000070 ":build.macppc.shared:PythonPPC.µ",
Jack Jansen05797151996-08-23 15:52:56 +000071 ":build.macppc.shared:PythonAppletPPC.µ",
Jack Jansenf04fa721996-04-10 14:51:14 +000072 ])
73]
Jack Jansen25b361f1996-08-20 16:35:30 +000074CFM68K_INSTRUCTIONS=[
75 (buildmwproject, "CWIE", [
76 ":build.mac68k.shared:PythonCoreCFM68K.µ",
77 ":build.mac68k.shared:PythonCFM68K.µ",
78 ":build.mac68k.shared:PythonAppletCFM68K.µ",
79 ])
80]
Jack Jansen05797151996-08-23 15:52:56 +000081FAT_INSTRUCTIONS=[
82 (buildmwproject, "CWIE", [
83 ":build.macppc.shared:Python.µ",
84 ":build.macppc.shared:PythonApplet.µ",
85 ])
86]
Jack Jansenf04fa721996-04-10 14:51:14 +000087PLUGIN_INSTRUCTIONS=[
88 (buildmwproject, "CWIE", [
Jack Jansen05797151996-08-23 15:52:56 +000089 ":PlugIns:ctb.ppc.µ",
Jack Jansene1d325f1996-12-23 16:56:19 +000090 ":PlugIns:gdbm.ppc.µ",
Jack Jansen52e87f31997-01-07 16:24:18 +000091 ":PlugIns:icglue.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.µ",
Jack Jansene1d325f1996-12-23 16:56:19 +0000103 ":PlugIns:gdbm.CFM68K.µ",
Jack Jansen52e87f31997-01-07 16:24:18 +0000104 ":PlugIns:icglue.CFM68K.µ",
Jack Jansend2034c11996-10-23 15:51:35 +0000105 ":PlugIns:imgmodules.CFM68K.µ",
Jack Jansen25b361f1996-08-20 16:35:30 +0000106 ":PlugIns:toolboxmodules.CFM68K.µ",
Jack Jansen05797151996-08-23 15:52:56 +0000107 ":PlugIns:qtmodules.CFM68K.µ",
108 ":PlugIns:waste.CFM68K.µ",
109 ":PlugIns:_tkinter.CFM68K.µ",
Jack Jansenf04fa721996-04-10 14:51:14 +0000110 ])
111]
112M68K_INSTRUCTIONS=[
113 (buildmwproject, "CWIE", [
Jack Jansen6655c4e1995-09-01 12:03:32 +0000114 ":build.mac68k.stand:Python68K.µ",
Jack Jansenf04fa721996-04-10 14:51:14 +0000115 ])
116]
Jack Jansen05797151996-08-23 15:52:56 +0000117PPCSTAND_INSTRUCTIONS=[
118 (buildmwproject, "CWIE", [
119 ":build.macppc.stand:PythonStandalone.µ",
120 ])
121]
Jack Jansen52e87f31997-01-07 16:24:18 +0000122EXTENSION_INSTRUCTIONS=[
123 (buildmwproject, "CWIE", [
124 ":Extensions:Imaging:_imaging.ppc.µ",
125 ":Extensions:Imaging:_imaging.CFM68K.µ",
126 ":Extensions:NumPy:numpymodules.ppc.µ",
127 ":Extensions:NumPy:numpymodules.CFM68K.µ",
128 ])
129]
Jack Jansenf04fa721996-04-10 14:51:14 +0000130APPLET_INSTRUCTIONS=[
Jack Jansen6655c4e1995-09-01 12:03:32 +0000131 (buildapplet, None, [
132 ":Mac:scripts:EditPythonPrefs.py",
133 ":Mac:scripts:mkapplet.py",
Jack Jansenb39a5d71995-10-09 23:19:30 +0000134 ":Mac:scripts:MkPluginAliases.py"
Jack Jansen6655c4e1995-09-01 12:03:32 +0000135 ])
136]
Jack Jansenf04fa721996-04-10 14:51:14 +0000137
138ALLINST=[
139 ("PPC shared executable", PPC_INSTRUCTIONS),
140 ("PPC plugin modules", PLUGIN_INSTRUCTIONS),
Jack Jansen25b361f1996-08-20 16:35:30 +0000141 ("CFM68K shared executable", CFM68K_INSTRUCTIONS),
Jack Jansen05797151996-08-23 15:52:56 +0000142 ("CFM68K plugin modules", CFM68KPLUGIN_INSTRUCTIONS),
143 ("FAT shared executables", FAT_INSTRUCTIONS),
Jack Jansen25b361f1996-08-20 16:35:30 +0000144 ("68K standalone executable", M68K_INSTRUCTIONS),
Jack Jansen05797151996-08-23 15:52:56 +0000145 ("PPC standalone executable", PPCSTAND_INSTRUCTIONS),
Jack Jansen52e87f31997-01-07 16:24:18 +0000146 ("Extensions", EXTENSION_INSTRUCTIONS),
Jack Jansen25b361f1996-08-20 16:35:30 +0000147 ("Applets", APPLET_INSTRUCTIONS)
Jack Jansenf04fa721996-04-10 14:51:14 +0000148]
Jack Jansen6655c4e1995-09-01 12:03:32 +0000149
150def main():
151 dir, ok = macfs.GetDirectory('Python source folder:')
152 if not ok:
153 sys.exit(0)
154 dir = dir.as_pathname()
Jack Jansenf04fa721996-04-10 14:51:14 +0000155 INSTRUCTIONS = []
156 for string, inst in ALLINST:
157 answer = EasyDialogs.AskYesNoCancel("Build %s?"%string, 1)
158 if answer < 0:
159 sys.exit(0)
160 if answer:
161 INSTRUCTIONS = INSTRUCTIONS + inst
Jack Jansen6655c4e1995-09-01 12:03:32 +0000162 for routine, arg, list in INSTRUCTIONS:
163 routine(dir, arg, list)
164 print "All done!"
165 sys.exit(1)
166
167if __name__ == '__main__':
168 main()
169