| 
									
										
										
										
											1995-09-01 12:03:32 +00:00
										 |  |  |  | # | 
					
						
							|  |  |  |  | # fullbuild creates everything that needs to be created before a | 
					
						
							|  |  |  |  | # distribution can be made, and puts it all in the right place. | 
					
						
							|  |  |  |  | # | 
					
						
							|  |  |  |  | # It expects the projects to be in the places where Jack likes them: | 
					
						
							|  |  |  |  | # in directories named like 'build.macppc.shared'. That is fixable, | 
					
						
							|  |  |  |  | # however. | 
					
						
							|  |  |  |  | # | 
					
						
							|  |  |  |  | # NOTE: You should proably make a copy of python with which to execute this | 
					
						
							|  |  |  |  | # script, rebuilding running programs does not work... | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | import os | 
					
						
							|  |  |  |  | import sys | 
					
						
							|  |  |  |  | import macfs | 
					
						
							| 
									
										
										
										
											1996-02-21 15:28:49 +00:00
										 |  |  |  | import MacOS | 
					
						
							| 
									
										
										
										
											1996-04-10 14:51:14 +00:00
										 |  |  |  | import EasyDialogs | 
					
						
							| 
									
										
										
										
											1995-09-01 12:03:32 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | import addpack | 
					
						
							|  |  |  |  | import aetools | 
					
						
							| 
									
										
										
										
											1996-02-21 15:28:49 +00:00
										 |  |  |  | import AppleEvents | 
					
						
							| 
									
										
										
										
											1995-09-01 12:03:32 +00:00
										 |  |  |  | from Metrowerks_Shell_Suite import Metrowerks_Shell_Suite | 
					
						
							|  |  |  |  | from Required_Suite import Required_Suite  | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | import mkapplet | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | class MwShell(aetools.TalkTo, Metrowerks_Shell_Suite, Required_Suite): | 
					
						
							|  |  |  |  | 	pass | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1996-04-10 14:51:14 +00:00
										 |  |  |  | RUNNING=[] | 
					
						
							| 
									
										
										
										
											1995-09-01 12:03:32 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | def buildmwproject(top, creator, projects): | 
					
						
							|  |  |  |  | 	"""Build projects with an MW compiler""" | 
					
						
							| 
									
										
										
										
											1996-09-20 15:30:52 +00:00
										 |  |  |  | 	mgr = MwShell(creator, start=1) | 
					
						
							| 
									
										
										
										
											1996-02-21 15:28:49 +00:00
										 |  |  |  | 	mgr.send_timeout = AppleEvents.kNoTimeOut | 
					
						
							|  |  |  |  | 	 | 
					
						
							| 
									
										
										
										
											1995-09-01 12:03:32 +00:00
										 |  |  |  | 	for file in projects: | 
					
						
							|  |  |  |  | 		file = os.path.join(top, file) | 
					
						
							|  |  |  |  | 		fss = macfs.FSSpec(file) | 
					
						
							|  |  |  |  | 		print 'Building', file | 
					
						
							|  |  |  |  | 		mgr.open(fss) | 
					
						
							| 
									
										
										
										
											1996-02-21 15:28:49 +00:00
										 |  |  |  | 		try: | 
					
						
							|  |  |  |  | 			mgr.Make_Project() | 
					
						
							| 
									
										
										
										
											1996-09-20 15:30:52 +00:00
										 |  |  |  | 		except aetools.Error, arg: | 
					
						
							|  |  |  |  | 			print '** Failed:', arg | 
					
						
							| 
									
										
										
										
											1995-09-01 12:03:32 +00:00
										 |  |  |  | 		mgr.Close_Project() | 
					
						
							| 
									
										
										
										
											1996-04-10 14:51:14 +00:00
										 |  |  |  | ##	mgr.quit() | 
					
						
							| 
									
										
										
										
											1995-09-01 12:03:32 +00:00
										 |  |  |  | 	 | 
					
						
							|  |  |  |  | def buildapplet(top, dummy, list): | 
					
						
							|  |  |  |  | 	"""Create a PPC python applet""" | 
					
						
							|  |  |  |  | 	template = mkapplet.findtemplate() | 
					
						
							|  |  |  |  | 	for src in list: | 
					
						
							|  |  |  |  | 		if src[-3:] != '.py': | 
					
						
							|  |  |  |  | 			raise 'Should end in .py', src | 
					
						
							|  |  |  |  | 		base = os.path.basename(src) | 
					
						
							|  |  |  |  | 		dst = os.path.join(top, base)[:-3] | 
					
						
							|  |  |  |  | 		src = os.path.join(top, src) | 
					
						
							|  |  |  |  | 		try: | 
					
						
							|  |  |  |  | 			os.unlink(dst) | 
					
						
							|  |  |  |  | 		except os.error: | 
					
						
							|  |  |  |  | 			pass | 
					
						
							|  |  |  |  | 		print 'Building applet', dst | 
					
						
							|  |  |  |  | 		mkapplet.process(template, src, dst) | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | # | 
					
						
							|  |  |  |  | # The build instructions. Entries are (routine, arg, list-of-files) | 
					
						
							|  |  |  |  | # XXXX We could also include the builds for stdwin and such here... | 
					
						
							| 
									
										
										
										
											1996-04-10 14:51:14 +00:00
										 |  |  |  | PPC_INSTRUCTIONS=[ | 
					
						
							| 
									
										
										
										
											1995-10-09 23:19:30 +00:00
										 |  |  |  | 	(buildmwproject, "CWIE", [ | 
					
						
							| 
									
										
										
										
											1996-08-23 15:52:56 +00:00
										 |  |  |  | 		":build.macppc.shared:PythonCorePPC.<2E>", | 
					
						
							| 
									
										
										
										
											1995-09-01 12:03:32 +00:00
										 |  |  |  | 		":build.macppc.shared:PythonPPC.<2E>", | 
					
						
							| 
									
										
										
										
											1996-08-23 15:52:56 +00:00
										 |  |  |  | 		":build.macppc.shared:PythonAppletPPC.<2E>", | 
					
						
							| 
									
										
										
										
											1996-04-10 14:51:14 +00:00
										 |  |  |  | 	]) | 
					
						
							|  |  |  |  | ] | 
					
						
							| 
									
										
										
										
											1996-08-20 16:35:30 +00:00
										 |  |  |  | CFM68K_INSTRUCTIONS=[ | 
					
						
							|  |  |  |  | 	(buildmwproject, "CWIE", [ | 
					
						
							|  |  |  |  | 		":build.mac68k.shared:PythonCoreCFM68K.<2E>", | 
					
						
							|  |  |  |  | 		":build.mac68k.shared:PythonCFM68K.<2E>", | 
					
						
							|  |  |  |  | 		":build.mac68k.shared:PythonAppletCFM68K.<2E>", | 
					
						
							|  |  |  |  | 	]) | 
					
						
							|  |  |  |  | ] | 
					
						
							| 
									
										
										
										
											1996-08-23 15:52:56 +00:00
										 |  |  |  | FAT_INSTRUCTIONS=[ | 
					
						
							|  |  |  |  | 	(buildmwproject, "CWIE", [ | 
					
						
							|  |  |  |  | 		":build.macppc.shared:Python.<2E>", | 
					
						
							|  |  |  |  | 		":build.macppc.shared:PythonApplet.<2E>", | 
					
						
							|  |  |  |  | 	]) | 
					
						
							|  |  |  |  | ] | 
					
						
							| 
									
										
										
										
											1996-04-10 14:51:14 +00:00
										 |  |  |  | PLUGIN_INSTRUCTIONS=[ | 
					
						
							|  |  |  |  | 	(buildmwproject, "CWIE", [ | 
					
						
							| 
									
										
										
										
											1996-08-23 15:52:56 +00:00
										 |  |  |  | 		":PlugIns:ctb.ppc.<2E>", | 
					
						
							| 
									
										
										
										
											1996-12-23 16:56:19 +00:00
										 |  |  |  | 		":PlugIns:gdbm.ppc.<2E>", | 
					
						
							| 
									
										
										
										
											1997-01-07 16:24:18 +00:00
										 |  |  |  | 		":PlugIns:icglue.ppc.<2E>", | 
					
						
							| 
									
										
										
										
											1996-08-20 16:35:30 +00:00
										 |  |  |  | 		":PlugIns:imgmodules.ppc.<2E>", | 
					
						
							| 
									
										
										
										
											1996-08-23 15:52:56 +00:00
										 |  |  |  | 		":PlugIns:macspeech.ppc.<2E>", | 
					
						
							| 
									
										
										
										
											1996-08-20 16:35:30 +00:00
										 |  |  |  | 		":PlugIns:toolboxmodules.ppc.<2E>", | 
					
						
							| 
									
										
										
										
											1996-08-23 15:52:56 +00:00
										 |  |  |  | 		":PlugIns:qtmodules.ppc.<2E>", | 
					
						
							|  |  |  |  | 		":PlugIns:waste.ppc.<2E>", | 
					
						
							|  |  |  |  | 		":PlugIns:_tkinter.ppc.<2E>", | 
					
						
							| 
									
										
										
										
											1996-08-20 16:35:30 +00:00
										 |  |  |  | 	]) | 
					
						
							|  |  |  |  | ] | 
					
						
							|  |  |  |  | CFM68KPLUGIN_INSTRUCTIONS=[ | 
					
						
							|  |  |  |  | 	(buildmwproject, "CWIE", [ | 
					
						
							| 
									
										
										
										
											1996-08-23 15:52:56 +00:00
										 |  |  |  | 		":PlugIns:ctb.CFM68K.<2E>", | 
					
						
							| 
									
										
										
										
											1996-12-23 16:56:19 +00:00
										 |  |  |  | 		":PlugIns:gdbm.CFM68K.<2E>", | 
					
						
							| 
									
										
										
										
											1997-01-07 16:24:18 +00:00
										 |  |  |  | 		":PlugIns:icglue.CFM68K.<2E>", | 
					
						
							| 
									
										
										
										
											1996-10-23 15:51:35 +00:00
										 |  |  |  | 		":PlugIns:imgmodules.CFM68K.<2E>", | 
					
						
							| 
									
										
										
										
											1996-08-20 16:35:30 +00:00
										 |  |  |  | 		":PlugIns:toolboxmodules.CFM68K.<2E>", | 
					
						
							| 
									
										
										
										
											1996-08-23 15:52:56 +00:00
										 |  |  |  | 		":PlugIns:qtmodules.CFM68K.<2E>", | 
					
						
							|  |  |  |  | 		":PlugIns:waste.CFM68K.<2E>", | 
					
						
							|  |  |  |  | 		":PlugIns:_tkinter.CFM68K.<2E>", | 
					
						
							| 
									
										
										
										
											1996-04-10 14:51:14 +00:00
										 |  |  |  | 	]) | 
					
						
							|  |  |  |  | ] | 
					
						
							|  |  |  |  | M68K_INSTRUCTIONS=[ | 
					
						
							|  |  |  |  | 	(buildmwproject, "CWIE", [ | 
					
						
							| 
									
										
										
										
											1995-09-01 12:03:32 +00:00
										 |  |  |  | 		":build.mac68k.stand:Python68K.<2E>", | 
					
						
							| 
									
										
										
										
											1996-04-10 14:51:14 +00:00
										 |  |  |  | 	]) | 
					
						
							|  |  |  |  | ] | 
					
						
							| 
									
										
										
										
											1996-08-23 15:52:56 +00:00
										 |  |  |  | PPCSTAND_INSTRUCTIONS=[ | 
					
						
							|  |  |  |  | 	(buildmwproject, "CWIE", [ | 
					
						
							|  |  |  |  | 		":build.macppc.stand:PythonStandalone.<2E>", | 
					
						
							|  |  |  |  | 	]) | 
					
						
							|  |  |  |  | ] | 
					
						
							| 
									
										
										
										
											1997-01-07 16:24:18 +00:00
										 |  |  |  | EXTENSION_INSTRUCTIONS=[ | 
					
						
							|  |  |  |  | 	(buildmwproject, "CWIE", [ | 
					
						
							|  |  |  |  | 		":Extensions:Imaging:_imaging.ppc.<2E>", | 
					
						
							|  |  |  |  | 		":Extensions:Imaging:_imaging.CFM68K.<2E>", | 
					
						
							| 
									
										
										
										
											1997-01-31 16:13:26 +00:00
										 |  |  |  | 		":Extensions:Imaging:_tkinter.ppc.<2E>", | 
					
						
							|  |  |  |  | 		":Extensions:Imaging:_tkinter.CFM68K.<2E>", | 
					
						
							| 
									
										
										
										
											1997-01-07 16:24:18 +00:00
										 |  |  |  | 		":Extensions:NumPy:numpymodules.ppc.<2E>", | 
					
						
							|  |  |  |  | 		":Extensions:NumPy:numpymodules.CFM68K.<2E>", | 
					
						
							|  |  |  |  | 	]) | 
					
						
							|  |  |  |  | ] | 
					
						
							| 
									
										
										
										
											1996-04-10 14:51:14 +00:00
										 |  |  |  | APPLET_INSTRUCTIONS=[ | 
					
						
							| 
									
										
										
										
											1995-09-01 12:03:32 +00:00
										 |  |  |  | 	(buildapplet, None, [ | 
					
						
							|  |  |  |  | 		":Mac:scripts:EditPythonPrefs.py", | 
					
						
							|  |  |  |  | 		":Mac:scripts:mkapplet.py", | 
					
						
							| 
									
										
										
										
											1995-10-09 23:19:30 +00:00
										 |  |  |  | 		":Mac:scripts:MkPluginAliases.py" | 
					
						
							| 
									
										
										
										
											1995-09-01 12:03:32 +00:00
										 |  |  |  | 	]) | 
					
						
							|  |  |  |  | ] | 
					
						
							| 
									
										
										
										
											1996-04-10 14:51:14 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | ALLINST=[ | 
					
						
							|  |  |  |  | 	("PPC shared executable", PPC_INSTRUCTIONS), | 
					
						
							|  |  |  |  | 	("PPC plugin modules", PLUGIN_INSTRUCTIONS), | 
					
						
							| 
									
										
										
										
											1996-08-20 16:35:30 +00:00
										 |  |  |  | 	("CFM68K shared executable", CFM68K_INSTRUCTIONS), | 
					
						
							| 
									
										
										
										
											1996-08-23 15:52:56 +00:00
										 |  |  |  | 	("CFM68K plugin modules", CFM68KPLUGIN_INSTRUCTIONS), | 
					
						
							|  |  |  |  | 	("FAT shared executables", FAT_INSTRUCTIONS), | 
					
						
							| 
									
										
										
										
											1996-08-20 16:35:30 +00:00
										 |  |  |  | 	("68K standalone executable", M68K_INSTRUCTIONS), | 
					
						
							| 
									
										
										
										
											1996-08-23 15:52:56 +00:00
										 |  |  |  | 	("PPC standalone executable", PPCSTAND_INSTRUCTIONS), | 
					
						
							| 
									
										
										
										
											1997-01-07 16:24:18 +00:00
										 |  |  |  | 	("Extensions", EXTENSION_INSTRUCTIONS), | 
					
						
							| 
									
										
										
										
											1996-08-20 16:35:30 +00:00
										 |  |  |  | 	("Applets", APPLET_INSTRUCTIONS) | 
					
						
							| 
									
										
										
										
											1996-04-10 14:51:14 +00:00
										 |  |  |  | ] | 
					
						
							| 
									
										
										
										
											1995-09-01 12:03:32 +00:00
										 |  |  |  | 				 | 
					
						
							|  |  |  |  | def main(): | 
					
						
							|  |  |  |  | 	dir, ok = macfs.GetDirectory('Python source folder:') | 
					
						
							|  |  |  |  | 	if not ok: | 
					
						
							|  |  |  |  | 		sys.exit(0) | 
					
						
							|  |  |  |  | 	dir = dir.as_pathname() | 
					
						
							| 
									
										
										
										
											1996-04-10 14:51:14 +00:00
										 |  |  |  | 	INSTRUCTIONS = [] | 
					
						
							|  |  |  |  | 	for string, inst in ALLINST: | 
					
						
							|  |  |  |  | 		answer = EasyDialogs.AskYesNoCancel("Build %s?"%string, 1) | 
					
						
							|  |  |  |  | 		if answer < 0: | 
					
						
							|  |  |  |  | 			sys.exit(0) | 
					
						
							|  |  |  |  | 		if answer: | 
					
						
							|  |  |  |  | 			INSTRUCTIONS = INSTRUCTIONS + inst | 
					
						
							| 
									
										
										
										
											1995-09-01 12:03:32 +00:00
										 |  |  |  | 	for routine, arg, list in INSTRUCTIONS: | 
					
						
							|  |  |  |  | 		routine(dir, arg, list) | 
					
						
							|  |  |  |  | 	print "All done!" | 
					
						
							|  |  |  |  | 	sys.exit(1)	 | 
					
						
							|  |  |  |  | 	 | 
					
						
							|  |  |  |  | if __name__ == '__main__': | 
					
						
							|  |  |  |  | 	main() | 
					
						
							|  |  |  |  | 	 |