1919import aetools
2020import AppleEvents
2121from Metrowerks_Shell_Suite import Metrowerks_Shell_Suite
22- from Required_Suite import Required_Suite
22+ from Required_Suite import Required_Suite
23+
24+ import Res
25+ import Dlg
2326
2427import mkapplet
28+ import cfmfile
29+
30+ # Dialog resource. Note that the item numbers should correspond
31+ # to those in the DITL resource. Also note that the order is important:
32+ # things are built in this order, so there should be no forward dependencies.
33+ DIALOG_ID = 512
34+
35+ I_OK = 1
36+ I_CANCEL = 2
37+
38+ I_PPC_CORE = 3
39+ I_PPC_PLUGINS = 4
40+ I_PPC_EXTENSIONS = 5
41+ I_68K_CORE = 6
42+ I_68K_PLUGINS = 7
43+ I_68K_EXTENSIONS = 8
44+ I_PPC_FULL = 9
45+ I_PPC_SMALL = 10
46+ I_68K_FULL = 11
47+ I_68K_SMALL = 12
48+ I_FAT = 13
49+ I_APPLETS = 14
50+
51+ N_BUTTONS = 15
2552
2653class MwShell (aetools .TalkTo , Metrowerks_Shell_Suite , Required_Suite ):
2754 pass
@@ -46,7 +73,7 @@ def buildmwproject(top, creator, projects):
4673## mgr.quit()
4774
4875def buildapplet (top , dummy , list ):
49- """Create a PPC python applet """
76+ """Create python applets """
5077 template = mkapplet .findtemplate ()
5178 for src in list :
5279 if src [- 3 :] != '.py' :
@@ -60,32 +87,55 @@ def buildapplet(top, dummy, list):
6087 pass
6188 print 'Building applet' , dst
6289 mkapplet .process (template , src , dst )
90+
91+ def buildfat (top , dummy , list ):
92+ """Build fat binaries"""
93+ for dst , src1 , src2 in list :
94+ dst = os .path .join (top , dst )
95+ src1 = os .path .join (top , src1 )
96+ src2 = os .path .join (top , src2 )
97+ print 'Building fat binary' , dst
98+ cfmfile .mergecfmfiles ((src1 , src2 ), dst )
99+
100+ def handle_dialog ():
101+ """Handle selection dialog, return list of selected items"""
102+ d = Dlg .GetNewDialog (DIALOG_ID , - 1 )
103+ d .SetDialogDefaultItem (I_OK )
104+ d .SetDialogCancelItem (I_CANCEL )
105+ results = [0 ]* N_BUTTONS
106+ while 1 :
107+ n = Dlg .ModalDialog (None )
108+ if n == I_OK :
109+ break
110+ if n == I_CANCEL :
111+ return []
112+ if n < len (results ):
113+ results [n ] = (not results [n ])
114+ tp , h , rect = d .GetDialogItem (n )
115+ h .as_Control ().SetControlValue (results [n ])
116+ rv = []
117+ for i in range (len (results )):
118+ if results [i ]:
119+ rv .append (i )
120+ return rv
63121
64122#
65123# The build instructions. Entries are (routine, arg, list-of-files)
66124# XXXX We could also include the builds for stdwin and such here...
67- PPC_INSTRUCTIONS = [
68- (buildmwproject , "CWIE" , [
125+ BUILD_DICT = {
126+ I_PPC_CORE : (buildmwproject , "CWIE" , [
69127 ":build.macppc.shared:PythonCorePPC.µ" ,
70128 ":build.macppc.shared:PythonPPC.µ" ,
71129 ":build.macppc.shared:PythonAppletPPC.µ" ,
72- ])
73- ]
74- CFM68K_INSTRUCTIONS = [
75- (buildmwproject , "CWIE" , [
130+ ]),
131+
132+ I_68K_CORE : (buildmwproject , "CWIE" , [
76133 ":build.mac68k.shared:PythonCoreCFM68K.µ" ,
77134 ":build.mac68k.shared:PythonCFM68K.µ" ,
78135 ":build.mac68k.shared:PythonAppletCFM68K.µ" ,
79- ])
80- ]
81- FAT_INSTRUCTIONS = [
82- (buildmwproject , "CWIE" , [
83- ":build.macppc.shared:Python.µ" ,
84- ":build.macppc.shared:PythonApplet.µ" ,
85- ])
86- ]
87- PLUGIN_INSTRUCTIONS = [
88- (buildmwproject , "CWIE" , [
136+ ]),
137+
138+ I_PPC_PLUGINS : (buildmwproject , "CWIE" , [
89139 ":PlugIns:ctb.ppc.µ" ,
90140 ":PlugIns:gdbm.ppc.µ" ,
91141 ":PlugIns:icglue.ppc.µ" ,
@@ -96,10 +146,9 @@ def buildapplet(top, dummy, list):
96146 ":PlugIns:waste.ppc.µ" ,
97147 ":PlugIns:_tkinter.ppc.µ" ,
98148 ":PlugIns:calldll.ppc.µ" ,
99- ])
100- ]
101- CFM68KPLUGIN_INSTRUCTIONS = [
102- (buildmwproject , "CWIE" , [
149+ ]),
150+
151+ I_68K_PLUGINS : (buildmwproject , "CWIE" , [
103152 ":PlugIns:ctb.CFM68K.µ" ,
104153 ":PlugIns:gdbm.CFM68K.µ" ,
105154 ":PlugIns:icglue.CFM68K.µ" ,
@@ -108,62 +157,71 @@ def buildapplet(top, dummy, list):
108157 ":PlugIns:qtmodules.CFM68K.µ" ,
109158 ":PlugIns:waste.CFM68K.µ" ,
110159 ":PlugIns:_tkinter.CFM68K.µ" ,
111- ])
112- ]
113- M68K_INSTRUCTIONS = [
114- (buildmwproject , "CWIE" , [
160+ ]),
161+
162+ I_68K_FULL : (buildmwproject , "CWIE" , [
115163 ":build.mac68k.stand:Python68K.µ" ,
116- ])
117- ]
118- PPCSTAND_INSTRUCTIONS = [
119- (buildmwproject , "CWIE" , [
164+ ]),
165+
166+ I_68K_SMALL : (buildmwproject , "CWIE" , [
167+ ":build.mac68k.stand:Python68Ksmall.µ" ,
168+ ]),
169+
170+ I_PPC_FULL : (buildmwproject , "CWIE" , [
120171 ":build.macppc.stand:PythonStandalone.µ" ,
121- ])
122- ]
123- EXTENSION_INSTRUCTIONS = [
124- (buildmwproject , "CWIE" , [
172+ ]),
173+
174+ I_PPC_SMALL : (buildmwproject , "CWIE" , [
175+ ":build.macppc.stand:PythonStandSmall.µ" ,
176+ ]),
177+
178+ I_PPC_EXTENSIONS : (buildmwproject , "CWIE" , [
125179 ":Extensions:Imaging:_imaging.ppc.µ" ,
126- ":Extensions:Imaging:_imaging.CFM68K.µ" ,
127180 ":Extensions:Imaging:_tkinter.ppc.µ" ,
128- ":Extensions:Imaging:_tkinter.CFM68K.µ" ,
129181 ":Extensions:NumPy:numpymodules.ppc.µ" ,
182+ ]),
183+
184+ I_68K_EXTENSIONS : (buildmwproject , "CWIE" , [
185+ ":Extensions:Imaging:_imaging.CFM68K.µ" ,
186+ ":Extensions:Imaging:_tkinter.CFM68K.µ" ,
130187 ":Extensions:NumPy:numpymodules.CFM68K.µ" ,
131- ])
132- ]
133- APPLET_INSTRUCTIONS = [
134- (buildapplet , None , [
188+ ]),
189+
190+ I_APPLETS : (buildapplet , None , [
135191 ":Mac:scripts:EditPythonPrefs.py" ,
136192 ":Mac:scripts:mkapplet.py" ,
137193 ":Mac:scripts:MkPluginAliases.py"
194+ ]),
195+
196+ I_FAT : (buildfat , None , [
197+ (":Python" , ":build.macppc.shared:PythonPPC" ,
198+ ":build.mac68k.shared:PythonCFM68K" ),
199+ (":PythonApplet" , ":build.macppc.shared:PythonAppletPPC" ,
200+ ":build.mac68k.shared:PythonAppletCFM68K" )
138201 ])
139- ]
140-
141- ALLINST = [
142- ("PPC shared executable" , PPC_INSTRUCTIONS ),
143- ("PPC plugin modules" , PLUGIN_INSTRUCTIONS ),
144- ("CFM68K shared executable" , CFM68K_INSTRUCTIONS ),
145- ("CFM68K plugin modules" , CFM68KPLUGIN_INSTRUCTIONS ),
146- ("FAT shared executables" , FAT_INSTRUCTIONS ),
147- ("68K standalone executable" , M68K_INSTRUCTIONS ),
148- ("PPC standalone executable" , PPCSTAND_INSTRUCTIONS ),
149- ("Extensions" , EXTENSION_INSTRUCTIONS ),
150- ("Applets" , APPLET_INSTRUCTIONS )
151- ]
202+ }
152203
153204def main ():
205+ try :
206+ h = Res .OpenResFile ('fullbuild.rsrc' )
207+ except Res .Error :
208+ pass # Assume we already have acces to our own resource
209+
154210 dir , ok = macfs .GetDirectory ('Python source folder:' )
155211 if not ok :
156212 sys .exit (0 )
157213 dir = dir .as_pathname ()
158- 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
165- for routine , arg , list in INSTRUCTIONS :
166- routine (dir , arg , list )
214+
215+ todo = handle_dialog ()
216+
217+ instructions = []
218+ for i in todo :
219+ instructions .append (BUILD_DICT [i ])
220+
221+ for routine , arg , list in instructions :
222+ #routine(dir, arg, list)
223+ print routine , dir , arg , list # DBG
224+
167225 print "All done!"
168226 sys .exit (1 )
169227
0 commit comments