blob: b332ea2ea8a2ca3199ffad861c8334c85ac05ede [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 Jansen25b361f1996-08-20 16:35:30 +000090 ":PlugIns:imgmodules.ppc.µ",
Jack Jansen05797151996-08-23 15:52:56 +000091 ":PlugIns:macspeech.ppc.µ",
Jack Jansen25b361f1996-08-20 16:35:30 +000092 ":PlugIns:toolboxmodules.ppc.µ",
Jack Jansen05797151996-08-23 15:52:56 +000093 ":PlugIns:qtmodules.ppc.µ",
94 ":PlugIns:waste.ppc.µ",
95 ":PlugIns:_tkinter.ppc.µ",
Jack Jansen25b361f1996-08-20 16:35:30 +000096 ])
97]
98CFM68KPLUGIN_INSTRUCTIONS=[
99 (buildmwproject, "CWIE", [
Jack Jansen05797151996-08-23 15:52:56 +0000100 ":PlugIns:ctb.CFM68K.µ",
Jack Jansend2034c11996-10-23 15:51:35 +0000101 ":PlugIns:imgmodules.CFM68K.µ",
Jack Jansen25b361f1996-08-20 16:35:30 +0000102 ":PlugIns:toolboxmodules.CFM68K.µ",
Jack Jansen05797151996-08-23 15:52:56 +0000103 ":PlugIns:qtmodules.CFM68K.µ",
104 ":PlugIns:waste.CFM68K.µ",
105 ":PlugIns:_tkinter.CFM68K.µ",
Jack Jansenf04fa721996-04-10 14:51:14 +0000106 ])
107]
108M68K_INSTRUCTIONS=[
109 (buildmwproject, "CWIE", [
Jack Jansen6655c4e1995-09-01 12:03:32 +0000110 ":build.mac68k.stand:Python68K.µ",
Jack Jansenf04fa721996-04-10 14:51:14 +0000111 ])
112]
Jack Jansen05797151996-08-23 15:52:56 +0000113PPCSTAND_INSTRUCTIONS=[
114 (buildmwproject, "CWIE", [
115 ":build.macppc.stand:PythonStandalone.µ",
116 ])
117]
Jack Jansenf04fa721996-04-10 14:51:14 +0000118APPLET_INSTRUCTIONS=[
Jack Jansen6655c4e1995-09-01 12:03:32 +0000119 (buildapplet, None, [
120 ":Mac:scripts:EditPythonPrefs.py",
121 ":Mac:scripts:mkapplet.py",
Jack Jansenb39a5d71995-10-09 23:19:30 +0000122 ":Mac:scripts:MkPluginAliases.py"
Jack Jansen6655c4e1995-09-01 12:03:32 +0000123 ])
124]
Jack Jansenf04fa721996-04-10 14:51:14 +0000125
126ALLINST=[
127 ("PPC shared executable", PPC_INSTRUCTIONS),
128 ("PPC plugin modules", PLUGIN_INSTRUCTIONS),
Jack Jansen25b361f1996-08-20 16:35:30 +0000129 ("CFM68K shared executable", CFM68K_INSTRUCTIONS),
Jack Jansen05797151996-08-23 15:52:56 +0000130 ("CFM68K plugin modules", CFM68KPLUGIN_INSTRUCTIONS),
131 ("FAT shared executables", FAT_INSTRUCTIONS),
Jack Jansen25b361f1996-08-20 16:35:30 +0000132 ("68K standalone executable", M68K_INSTRUCTIONS),
Jack Jansen05797151996-08-23 15:52:56 +0000133 ("PPC standalone executable", PPCSTAND_INSTRUCTIONS),
Jack Jansen25b361f1996-08-20 16:35:30 +0000134 ("Applets", APPLET_INSTRUCTIONS)
Jack Jansenf04fa721996-04-10 14:51:14 +0000135]
Jack Jansen6655c4e1995-09-01 12:03:32 +0000136
137def main():
138 dir, ok = macfs.GetDirectory('Python source folder:')
139 if not ok:
140 sys.exit(0)
141 dir = dir.as_pathname()
Jack Jansenf04fa721996-04-10 14:51:14 +0000142 INSTRUCTIONS = []
143 for string, inst in ALLINST:
144 answer = EasyDialogs.AskYesNoCancel("Build %s?"%string, 1)
145 if answer < 0:
146 sys.exit(0)
147 if answer:
148 INSTRUCTIONS = INSTRUCTIONS + inst
Jack Jansen6655c4e1995-09-01 12:03:32 +0000149 for routine, arg, list in INSTRUCTIONS:
150 routine(dir, arg, list)
151 print "All done!"
152 sys.exit(1)
153
154if __name__ == '__main__':
155 main()
156