1995-09-01 09:03:32 -03: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 11:28:49 -04:00
|
|
|
|
import MacOS
|
1996-04-10 11:51:14 -03:00
|
|
|
|
import EasyDialogs
|
1995-09-01 09:03:32 -03:00
|
|
|
|
|
|
|
|
|
import addpack
|
|
|
|
|
import aetools
|
1996-02-21 11:28:49 -04:00
|
|
|
|
import AppleEvents
|
1995-09-01 09:03:32 -03:00
|
|
|
|
from Metrowerks_Shell_Suite import Metrowerks_Shell_Suite
|
1997-05-06 13:15:32 -03:00
|
|
|
|
from Required_Suite import Required_Suite
|
|
|
|
|
|
|
|
|
|
import Res
|
|
|
|
|
import Dlg
|
1995-09-01 09:03:32 -03:00
|
|
|
|
|
|
|
|
|
import mkapplet
|
1997-05-06 13:15:32 -03:00
|
|
|
|
import cfmfile
|
|
|
|
|
|
|
|
|
|
# Dialog resource. Note that the item numbers should correspond
|
|
|
|
|
# to those in the DITL resource. Also note that the order is important:
|
|
|
|
|
# things are built in this order, so there should be no forward dependencies.
|
|
|
|
|
DIALOG_ID = 512
|
|
|
|
|
|
|
|
|
|
I_OK=1
|
|
|
|
|
I_CANCEL=2
|
|
|
|
|
|
|
|
|
|
I_PPC_CORE=3
|
|
|
|
|
I_PPC_PLUGINS=4
|
|
|
|
|
I_PPC_EXTENSIONS=5
|
|
|
|
|
I_68K_CORE=6
|
|
|
|
|
I_68K_PLUGINS=7
|
|
|
|
|
I_68K_EXTENSIONS=8
|
|
|
|
|
I_PPC_FULL=9
|
|
|
|
|
I_PPC_SMALL=10
|
|
|
|
|
I_68K_FULL=11
|
|
|
|
|
I_68K_SMALL=12
|
|
|
|
|
I_FAT=13
|
|
|
|
|
I_APPLETS=14
|
|
|
|
|
|
|
|
|
|
N_BUTTONS=15
|
1995-09-01 09:03:32 -03:00
|
|
|
|
|
|
|
|
|
class MwShell(aetools.TalkTo, Metrowerks_Shell_Suite, Required_Suite):
|
|
|
|
|
pass
|
|
|
|
|
|
1996-04-10 11:51:14 -03:00
|
|
|
|
RUNNING=[]
|
1995-09-01 09:03:32 -03:00
|
|
|
|
|
|
|
|
|
def buildmwproject(top, creator, projects):
|
|
|
|
|
"""Build projects with an MW compiler"""
|
1996-09-20 12:30:52 -03:00
|
|
|
|
mgr = MwShell(creator, start=1)
|
1996-02-21 11:28:49 -04:00
|
|
|
|
mgr.send_timeout = AppleEvents.kNoTimeOut
|
|
|
|
|
|
1995-09-01 09:03:32 -03:00
|
|
|
|
for file in projects:
|
|
|
|
|
file = os.path.join(top, file)
|
|
|
|
|
fss = macfs.FSSpec(file)
|
|
|
|
|
print 'Building', file
|
|
|
|
|
mgr.open(fss)
|
1996-02-21 11:28:49 -04:00
|
|
|
|
try:
|
|
|
|
|
mgr.Make_Project()
|
1996-09-20 12:30:52 -03:00
|
|
|
|
except aetools.Error, arg:
|
|
|
|
|
print '** Failed:', arg
|
1995-09-01 09:03:32 -03:00
|
|
|
|
mgr.Close_Project()
|
1996-04-10 11:51:14 -03:00
|
|
|
|
## mgr.quit()
|
1995-09-01 09:03:32 -03:00
|
|
|
|
|
|
|
|
|
def buildapplet(top, dummy, list):
|
1997-05-06 13:15:32 -03:00
|
|
|
|
"""Create python applets"""
|
1995-09-01 09:03:32 -03:00
|
|
|
|
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)
|
1997-05-06 13:15:32 -03:00
|
|
|
|
|
|
|
|
|
def buildfat(top, dummy, list):
|
|
|
|
|
"""Build fat binaries"""
|
|
|
|
|
for dst, src1, src2 in list:
|
|
|
|
|
dst = os.path.join(top, dst)
|
|
|
|
|
src1 = os.path.join(top, src1)
|
|
|
|
|
src2 = os.path.join(top, src2)
|
|
|
|
|
print 'Building fat binary', dst
|
|
|
|
|
cfmfile.mergecfmfiles((src1, src2), dst)
|
|
|
|
|
|
|
|
|
|
def handle_dialog():
|
|
|
|
|
"""Handle selection dialog, return list of selected items"""
|
|
|
|
|
d = Dlg.GetNewDialog(DIALOG_ID, -1)
|
|
|
|
|
d.SetDialogDefaultItem(I_OK)
|
|
|
|
|
d.SetDialogCancelItem(I_CANCEL)
|
|
|
|
|
results = [0]*N_BUTTONS
|
|
|
|
|
while 1:
|
|
|
|
|
n = Dlg.ModalDialog(None)
|
|
|
|
|
if n == I_OK:
|
|
|
|
|
break
|
|
|
|
|
if n == I_CANCEL:
|
|
|
|
|
return []
|
|
|
|
|
if n < len(results):
|
|
|
|
|
results[n] = (not results[n])
|
|
|
|
|
tp, h, rect = d.GetDialogItem(n)
|
|
|
|
|
h.as_Control().SetControlValue(results[n])
|
|
|
|
|
rv = []
|
|
|
|
|
for i in range(len(results)):
|
|
|
|
|
if results[i]:
|
|
|
|
|
rv.append(i)
|
|
|
|
|
return rv
|
1995-09-01 09:03:32 -03:00
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# The build instructions. Entries are (routine, arg, list-of-files)
|
|
|
|
|
# XXXX We could also include the builds for stdwin and such here...
|
1997-05-06 13:15:32 -03:00
|
|
|
|
BUILD_DICT = {
|
|
|
|
|
I_PPC_CORE : (buildmwproject, "CWIE", [
|
1996-08-23 12:52:56 -03:00
|
|
|
|
":build.macppc.shared:PythonCorePPC.<2E>",
|
1995-09-01 09:03:32 -03:00
|
|
|
|
":build.macppc.shared:PythonPPC.<2E>",
|
1996-08-23 12:52:56 -03:00
|
|
|
|
":build.macppc.shared:PythonAppletPPC.<2E>",
|
1997-05-06 13:15:32 -03:00
|
|
|
|
]),
|
|
|
|
|
|
|
|
|
|
I_68K_CORE : (buildmwproject, "CWIE", [
|
1996-08-20 13:35:30 -03:00
|
|
|
|
":build.mac68k.shared:PythonCoreCFM68K.<2E>",
|
|
|
|
|
":build.mac68k.shared:PythonCFM68K.<2E>",
|
|
|
|
|
":build.mac68k.shared:PythonAppletCFM68K.<2E>",
|
1997-05-06 13:15:32 -03:00
|
|
|
|
]),
|
|
|
|
|
|
|
|
|
|
I_PPC_PLUGINS : (buildmwproject, "CWIE", [
|
1997-05-07 12:52:12 -03:00
|
|
|
|
":PlugIns:toolboxmodules.ppc.<2E>", # First: used by others
|
|
|
|
|
":PlugIns:qtmodules.ppc.<2E>",
|
1996-08-23 12:52:56 -03:00
|
|
|
|
":PlugIns:ctb.ppc.<2E>",
|
1996-12-23 12:56:19 -04:00
|
|
|
|
":PlugIns:gdbm.ppc.<2E>",
|
1997-01-07 12:24:18 -04:00
|
|
|
|
":PlugIns:icglue.ppc.<2E>",
|
1996-08-20 13:35:30 -03:00
|
|
|
|
":PlugIns:imgmodules.ppc.<2E>",
|
1996-08-23 12:52:56 -03:00
|
|
|
|
":PlugIns:macspeech.ppc.<2E>",
|
|
|
|
|
":PlugIns:waste.ppc.<2E>",
|
|
|
|
|
":PlugIns:_tkinter.ppc.<2E>",
|
1997-02-20 11:27:44 -04:00
|
|
|
|
":PlugIns:calldll.ppc.<2E>",
|
1997-06-03 12:30:39 -03:00
|
|
|
|
":PlugIns:zlib.ppc.<2E>",
|
1997-05-06 13:15:32 -03:00
|
|
|
|
]),
|
|
|
|
|
|
|
|
|
|
I_68K_PLUGINS : (buildmwproject, "CWIE", [
|
1997-05-07 12:52:12 -03:00
|
|
|
|
":PlugIns:toolboxmodules.CFM68K.<2E>", # First: used by others
|
|
|
|
|
":PlugIns:qtmodules.CFM68K.<2E>",
|
1996-08-23 12:52:56 -03:00
|
|
|
|
":PlugIns:ctb.CFM68K.<2E>",
|
1996-12-23 12:56:19 -04:00
|
|
|
|
":PlugIns:gdbm.CFM68K.<2E>",
|
1997-01-07 12:24:18 -04:00
|
|
|
|
":PlugIns:icglue.CFM68K.<2E>",
|
1996-10-23 12:51:35 -03:00
|
|
|
|
":PlugIns:imgmodules.CFM68K.<2E>",
|
1996-08-23 12:52:56 -03:00
|
|
|
|
":PlugIns:waste.CFM68K.<2E>",
|
|
|
|
|
":PlugIns:_tkinter.CFM68K.<2E>",
|
1997-06-03 12:30:39 -03:00
|
|
|
|
":PlugIns:zlib.CFM68K.<2E>",
|
1997-05-06 13:15:32 -03:00
|
|
|
|
]),
|
|
|
|
|
|
|
|
|
|
I_68K_FULL : (buildmwproject, "CWIE", [
|
1995-09-01 09:03:32 -03:00
|
|
|
|
":build.mac68k.stand:Python68K.<2E>",
|
1997-05-06 13:15:32 -03:00
|
|
|
|
]),
|
|
|
|
|
|
|
|
|
|
I_68K_SMALL : (buildmwproject, "CWIE", [
|
|
|
|
|
":build.mac68k.stand:Python68Ksmall.<2E>",
|
|
|
|
|
]),
|
|
|
|
|
|
|
|
|
|
I_PPC_FULL : (buildmwproject, "CWIE", [
|
1996-08-23 12:52:56 -03:00
|
|
|
|
":build.macppc.stand:PythonStandalone.<2E>",
|
1997-05-06 13:15:32 -03:00
|
|
|
|
]),
|
|
|
|
|
|
|
|
|
|
I_PPC_SMALL : (buildmwproject, "CWIE", [
|
|
|
|
|
":build.macppc.stand:PythonStandSmall.<2E>",
|
|
|
|
|
]),
|
|
|
|
|
|
|
|
|
|
I_PPC_EXTENSIONS : (buildmwproject, "CWIE", [
|
1997-01-07 12:24:18 -04:00
|
|
|
|
":Extensions:Imaging:_imaging.ppc.<2E>",
|
1997-01-31 12:13:26 -04:00
|
|
|
|
":Extensions:Imaging:_tkinter.ppc.<2E>",
|
1997-01-07 12:24:18 -04:00
|
|
|
|
":Extensions:NumPy:numpymodules.ppc.<2E>",
|
1997-05-06 13:15:32 -03:00
|
|
|
|
]),
|
|
|
|
|
|
|
|
|
|
I_68K_EXTENSIONS : (buildmwproject, "CWIE", [
|
|
|
|
|
":Extensions:Imaging:_imaging.CFM68K.<2E>",
|
|
|
|
|
":Extensions:Imaging:_tkinter.CFM68K.<2E>",
|
1997-01-07 12:24:18 -04:00
|
|
|
|
":Extensions:NumPy:numpymodules.CFM68K.<2E>",
|
1997-05-06 13:15:32 -03:00
|
|
|
|
]),
|
|
|
|
|
|
|
|
|
|
I_APPLETS : (buildapplet, None, [
|
1995-09-01 09:03:32 -03:00
|
|
|
|
":Mac:scripts:EditPythonPrefs.py",
|
|
|
|
|
":Mac:scripts:mkapplet.py",
|
1995-10-09 20:19:30 -03:00
|
|
|
|
":Mac:scripts:MkPluginAliases.py"
|
1997-05-06 13:15:32 -03:00
|
|
|
|
]),
|
|
|
|
|
|
|
|
|
|
I_FAT : (buildfat, None, [
|
1997-05-07 12:52:12 -03:00
|
|
|
|
(":PythonFAT", ":build.macppc.shared:PythonPPC",
|
1997-05-06 13:15:32 -03:00
|
|
|
|
":build.mac68k.shared:PythonCFM68K"),
|
|
|
|
|
(":PythonApplet", ":build.macppc.shared:PythonAppletPPC",
|
|
|
|
|
":build.mac68k.shared:PythonAppletCFM68K")
|
1995-09-01 09:03:32 -03:00
|
|
|
|
])
|
1997-05-06 13:15:32 -03:00
|
|
|
|
}
|
1995-09-01 09:03:32 -03:00
|
|
|
|
|
|
|
|
|
def main():
|
1997-05-06 13:15:32 -03:00
|
|
|
|
try:
|
|
|
|
|
h = Res.OpenResFile('fullbuild.rsrc')
|
|
|
|
|
except Res.Error:
|
|
|
|
|
pass # Assume we already have acces to our own resource
|
|
|
|
|
|
1995-09-01 09:03:32 -03:00
|
|
|
|
dir, ok = macfs.GetDirectory('Python source folder:')
|
|
|
|
|
if not ok:
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
dir = dir.as_pathname()
|
1997-05-06 13:15:32 -03:00
|
|
|
|
|
|
|
|
|
todo = handle_dialog()
|
|
|
|
|
|
|
|
|
|
instructions = []
|
|
|
|
|
for i in todo:
|
|
|
|
|
instructions.append(BUILD_DICT[i])
|
|
|
|
|
|
|
|
|
|
for routine, arg, list in instructions:
|
1997-05-07 12:52:12 -03:00
|
|
|
|
routine(dir, arg, list)
|
1997-05-06 13:15:32 -03:00
|
|
|
|
|
1995-09-01 09:03:32 -03:00
|
|
|
|
print "All done!"
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
main()
|
|
|
|
|
|