blob: e49eabbe03821417d0ace2fefedb7d7af239dd7a [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 Jansenab786561997-02-20 15:27:44 +000098 ":PlugIns:calldll.ppc.µ",
Jack Jansen25b361f1996-08-20 16:35:30 +000099 ])
100]
101CFM68KPLUGIN_INSTRUCTIONS=[
102 (buildmwproject, "CWIE", [
Jack Jansen05797151996-08-23 15:52:56 +0000103 ":PlugIns:ctb.CFM68K.µ",
Jack Jansene1d325f1996-12-23 16:56:19 +0000104 ":PlugIns:gdbm.CFM68K.µ",
Jack Jansen52e87f31997-01-07 16:24:18 +0000105 ":PlugIns:icglue.CFM68K.µ",
Jack Jansend2034c11996-10-23 15:51:35 +0000106 ":PlugIns:imgmodules.CFM68K.µ",
Jack Jansen25b361f1996-08-20 16:35:30 +0000107 ":PlugIns:toolboxmodules.CFM68K.µ",
Jack Jansen05797151996-08-23 15:52:56 +0000108 ":PlugIns:qtmodules.CFM68K.µ",
109 ":PlugIns:waste.CFM68K.µ",
110 ":PlugIns:_tkinter.CFM68K.µ",
Jack Jansenf04fa721996-04-10 14:51:14 +0000111 ])
112]
113M68K_INSTRUCTIONS=[
114 (buildmwproject, "CWIE", [
Jack Jansen6655c4e1995-09-01 12:03:32 +0000115 ":build.mac68k.stand:Python68K.µ",
Jack Jansenf04fa721996-04-10 14:51:14 +0000116 ])
117]
Jack Jansen05797151996-08-23 15:52:56 +0000118PPCSTAND_INSTRUCTIONS=[
119 (buildmwproject, "CWIE", [
120 ":build.macppc.stand:PythonStandalone.µ",
121 ])
122]
Jack Jansen52e87f31997-01-07 16:24:18 +0000123EXTENSION_INSTRUCTIONS=[
124 (buildmwproject, "CWIE", [
125 ":Extensions:Imaging:_imaging.ppc.µ",
126 ":Extensions:Imaging:_imaging.CFM68K.µ",
Jack Jansen02dee9b1997-01-31 16:13:26 +0000127 ":Extensions:Imaging:_tkinter.ppc.µ",
128 ":Extensions:Imaging:_tkinter.CFM68K.µ",
Jack Jansen52e87f31997-01-07 16:24:18 +0000129 ":Extensions:NumPy:numpymodules.ppc.µ",
130 ":Extensions:NumPy:numpymodules.CFM68K.µ",
131 ])
132]
Jack Jansenf04fa721996-04-10 14:51:14 +0000133APPLET_INSTRUCTIONS=[
Jack Jansen6655c4e1995-09-01 12:03:32 +0000134 (buildapplet, None, [
135 ":Mac:scripts:EditPythonPrefs.py",
136 ":Mac:scripts:mkapplet.py",
Jack Jansenb39a5d71995-10-09 23:19:30 +0000137 ":Mac:scripts:MkPluginAliases.py"
Jack Jansen6655c4e1995-09-01 12:03:32 +0000138 ])
139]
Jack Jansenf04fa721996-04-10 14:51:14 +0000140
141ALLINST=[
142 ("PPC shared executable", PPC_INSTRUCTIONS),
143 ("PPC plugin modules", PLUGIN_INSTRUCTIONS),
Jack Jansen25b361f1996-08-20 16:35:30 +0000144 ("CFM68K shared executable", CFM68K_INSTRUCTIONS),
Jack Jansen05797151996-08-23 15:52:56 +0000145 ("CFM68K plugin modules", CFM68KPLUGIN_INSTRUCTIONS),
146 ("FAT shared executables", FAT_INSTRUCTIONS),
Jack Jansen25b361f1996-08-20 16:35:30 +0000147 ("68K standalone executable", M68K_INSTRUCTIONS),
Jack Jansen05797151996-08-23 15:52:56 +0000148 ("PPC standalone executable", PPCSTAND_INSTRUCTIONS),
Jack Jansen52e87f31997-01-07 16:24:18 +0000149 ("Extensions", EXTENSION_INSTRUCTIONS),
Jack Jansen25b361f1996-08-20 16:35:30 +0000150 ("Applets", APPLET_INSTRUCTIONS)
Jack Jansenf04fa721996-04-10 14:51:14 +0000151]
Jack Jansen6655c4e1995-09-01 12:03:32 +0000152
153def main():
154 dir, ok = macfs.GetDirectory('Python source folder:')
155 if not ok:
156 sys.exit(0)
157 dir = dir.as_pathname()
Jack Jansenf04fa721996-04-10 14:51:14 +0000158 INSTRUCTIONS = []
159 for string, inst in ALLINST:
160 answer = EasyDialogs.AskYesNoCancel("Build %s?"%string, 1)
161 if answer < 0:
162 sys.exit(0)
163 if answer:
164 INSTRUCTIONS = INSTRUCTIONS + inst
Jack Jansen6655c4e1995-09-01 12:03:32 +0000165 for routine, arg, list in INSTRUCTIONS:
166 routine(dir, arg, list)
167 print "All done!"
168 sys.exit(1)
169
170if __name__ == '__main__':
171 main()
172