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:
|
1997-09-01 12:37:07 -03:00
|
|
|
# in directories named like 'build.mac'. That is fixable,
|
1995-09-01 09:03:32 -03:00
|
|
|
# however.
|
|
|
|
#
|
|
|
|
# NOTE: You should proably make a copy of python with which to execute this
|
|
|
|
# script, rebuilding running programs does not work...
|
|
|
|
|
1997-09-01 12:37:07 -03:00
|
|
|
MACBUILDNO=":Mac:Include:macbuildno.h"
|
|
|
|
|
1995-09-01 09:03:32 -03:00
|
|
|
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
|
1997-09-01 12:37:07 -03:00
|
|
|
import regex
|
|
|
|
import string
|
1995-09-01 09:03:32 -03:00
|
|
|
|
|
|
|
import aetools
|
1996-02-21 11:28:49 -04:00
|
|
|
import AppleEvents
|
2000-08-17 19:12:12 -03:00
|
|
|
|
|
|
|
OLDAESUPPORT = 0
|
|
|
|
|
|
|
|
if OLDAESUPPORT:
|
|
|
|
from Metrowerks_Shell_Suite import Metrowerks_Shell_Suite
|
|
|
|
from CodeWarrior_suite import CodeWarrior_suite
|
|
|
|
from Metrowerks_Standard_Suite import Metrowerks_Standard_Suite
|
|
|
|
from Required_Suite import Required_Suite
|
|
|
|
else:
|
|
|
|
import CodeWarrior
|
1997-05-06 13:15:32 -03:00
|
|
|
|
|
|
|
import Res
|
|
|
|
import Dlg
|
1995-09-01 09:03:32 -03:00
|
|
|
|
1998-07-31 06:45:27 -03:00
|
|
|
import buildtools
|
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
|
1997-09-09 10:57:15 -03:00
|
|
|
I_INC_BUILDNO=19
|
1997-05-06 13:15:32 -03:00
|
|
|
|
1997-08-27 11:10:29 -03:00
|
|
|
I_CORE=3
|
1997-05-06 13:15:32 -03:00
|
|
|
I_PPC_PLUGINS=4
|
|
|
|
I_PPC_EXTENSIONS=5
|
1997-08-27 11:10:29 -03:00
|
|
|
I_68K_PLUGINS=6
|
|
|
|
I_68K_EXTENSIONS=7
|
|
|
|
I_PPC_FULL=8
|
|
|
|
I_PPC_SMALL=9
|
|
|
|
I_68K_FULL=10
|
|
|
|
I_68K_SMALL=11
|
|
|
|
I_APPLETS=12
|
|
|
|
|
|
|
|
N_BUTTONS=13
|
|
|
|
|
2000-08-17 19:12:12 -03:00
|
|
|
if OLDAESUPPORT:
|
|
|
|
class MwShell(Metrowerks_Shell_Suite, CodeWarrior_suite, Metrowerks_Standard_Suite,
|
|
|
|
Required_Suite, aetools.TalkTo):
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
MwShell = CodeWarrior.CodeWarrior
|
1995-09-01 09:03:32 -03:00
|
|
|
|
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
|
|
|
|
|
2000-07-24 16:45:07 -03:00
|
|
|
failed = []
|
1995-09-01 09:03:32 -03:00
|
|
|
for file in projects:
|
1997-08-27 11:10:29 -03:00
|
|
|
if type(file) == type(()):
|
|
|
|
file, target = file
|
|
|
|
else:
|
|
|
|
target = ''
|
1995-09-01 09:03:32 -03:00
|
|
|
file = os.path.join(top, file)
|
1999-01-30 14:27:12 -04:00
|
|
|
try:
|
|
|
|
fss = macfs.FSSpec(file)
|
|
|
|
except ValueError:
|
|
|
|
print '** file not found:', file
|
|
|
|
continue
|
1997-08-27 11:10:29 -03:00
|
|
|
print 'Building', file, target
|
1999-01-30 14:27:12 -04:00
|
|
|
try:
|
|
|
|
mgr.open(fss)
|
|
|
|
except aetools.Error, detail:
|
|
|
|
print '**', detail, file
|
|
|
|
continue
|
1997-08-27 11:10:29 -03:00
|
|
|
if target:
|
|
|
|
try:
|
|
|
|
mgr.Set_Current_Target(target)
|
|
|
|
except aetools.Error, arg:
|
|
|
|
print '**', file, target, 'Cannot select:', arg
|
1996-02-21 11:28:49 -04:00
|
|
|
try:
|
|
|
|
mgr.Make_Project()
|
1996-09-20 12:30:52 -03:00
|
|
|
except aetools.Error, arg:
|
1997-08-27 11:10:29 -03:00
|
|
|
print '**', file, target, 'Failed:', arg
|
2000-07-24 16:45:07 -03:00
|
|
|
failed.append(fss)
|
1995-09-01 09:03:32 -03:00
|
|
|
mgr.Close_Project()
|
2000-07-24 16:45:07 -03:00
|
|
|
if failed:
|
|
|
|
print 'Open failed projects and exit?',
|
|
|
|
rv = sys.stdin.readline()
|
|
|
|
if rv[0] in ('y', 'Y'):
|
|
|
|
for fss in failed:
|
|
|
|
mgr.open(fss)
|
|
|
|
sys.exit(0)
|
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"""
|
1998-07-31 06:45:27 -03:00
|
|
|
template = buildtools.findtemplate()
|
1999-01-31 21:21:18 -04:00
|
|
|
for src, dst in list:
|
1995-09-01 09:03:32 -03:00
|
|
|
if src[-3:] != '.py':
|
|
|
|
raise 'Should end in .py', src
|
|
|
|
base = os.path.basename(src)
|
|
|
|
src = os.path.join(top, src)
|
1999-01-31 21:21:18 -04:00
|
|
|
dst = os.path.join(top, dst)
|
1995-09-01 09:03:32 -03:00
|
|
|
try:
|
|
|
|
os.unlink(dst)
|
|
|
|
except os.error:
|
|
|
|
pass
|
|
|
|
print 'Building applet', dst
|
1998-07-31 06:45:27 -03:00
|
|
|
buildtools.process(template, src, dst, 1)
|
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)
|
|
|
|
|
1997-09-09 10:57:15 -03:00
|
|
|
def handle_dialog(filename):
|
1997-05-06 13:15:32 -03:00
|
|
|
"""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 []
|
1997-09-09 10:57:15 -03:00
|
|
|
if n == I_INC_BUILDNO:
|
|
|
|
incbuildno(filename)
|
|
|
|
continue
|
1997-05-06 13:15:32 -03:00
|
|
|
if n < len(results):
|
|
|
|
results[n] = (not results[n])
|
1999-12-24 09:39:23 -04:00
|
|
|
ctl = d.GetDialogItemAsControl(n)
|
|
|
|
ctl.SetControlValue(results[n])
|
1997-05-06 13:15:32 -03:00
|
|
|
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 = {
|
1997-08-27 11:10:29 -03:00
|
|
|
I_CORE : (buildmwproject, "CWIE", [
|
1999-01-28 13:46:50 -04:00
|
|
|
(":Mac:Build:PythonCore.prj", "PythonCore"),
|
1999-02-14 19:12:06 -04:00
|
|
|
(":Mac:Build:PythonInterpreter.prj", "PythonInterpreter"),
|
1997-05-06 13:15:32 -03:00
|
|
|
]),
|
|
|
|
|
|
|
|
I_PPC_PLUGINS : (buildmwproject, "CWIE", [
|
2000-07-07 10:08:09 -03:00
|
|
|
(":Mac:Build:ucnhash.prj", "ucnhash.ppc"),
|
2000-09-08 07:19:04 -03:00
|
|
|
(":Mac:Build:pyexpat.prj", "pyexpat.ppc"),
|
1999-02-12 06:29:06 -04:00
|
|
|
(":Mac:Build:calldll.ppc.prj", "calldll.ppc"),
|
|
|
|
(":Mac:Build:ctb.prj", "ctb.ppc"),
|
|
|
|
(":Mac:Build:gdbm.prj", "gdbm.ppc"),
|
|
|
|
(":Mac:Build:icglue.prj", "icglue.ppc"),
|
|
|
|
(":Mac:Build:macspeech.prj", "macspeech.ppc"),
|
|
|
|
(":Mac:Build:waste.prj", "waste.ppc"),
|
|
|
|
(":Mac:Build:zlib.prj", "zlib.ppc"),
|
2000-04-23 19:13:15 -03:00
|
|
|
## (":Mac:Build:_tkinter.prj", "_tkinter.ppc"),
|
|
|
|
(":Extensions:Imaging:_tkinter.prj", "_tkinter.ppc"),
|
1999-02-12 06:29:06 -04:00
|
|
|
(":Mac:Build:ColorPicker.prj", "ColorPicker.ppc"),
|
|
|
|
(":Mac:Build:Printing.prj", "Printing.ppc"),
|
1999-03-04 19:00:11 -04:00
|
|
|
(":Mac:Build:App.prj", "App.ppc"),
|
1999-02-12 06:29:06 -04:00
|
|
|
(":Mac:Build:Cm.prj", "Cm.ppc"),
|
2000-04-08 18:29:31 -03:00
|
|
|
(":Mac:Build:Drag.prj", "Drag.ppc"),
|
1999-02-12 06:29:06 -04:00
|
|
|
(":Mac:Build:Fm.prj", "Fm.ppc"),
|
|
|
|
(":Mac:Build:Help.prj", "Help.ppc"),
|
|
|
|
(":Mac:Build:Icn.prj", "Icn.ppc"),
|
|
|
|
(":Mac:Build:List.prj", "List.ppc"),
|
1999-03-07 19:10:32 -04:00
|
|
|
(":Mac:Build:Qdoffs.prj", "Qdoffs.ppc"),
|
1999-02-12 06:29:06 -04:00
|
|
|
(":Mac:Build:Qt.prj", "Qt.ppc"),
|
|
|
|
(":Mac:Build:Scrap.prj", "Scrap.ppc"),
|
|
|
|
(":Mac:Build:Snd.prj", "Snd.ppc"),
|
|
|
|
(":Mac:Build:Sndihooks.prj", "Sndihooks.ppc"),
|
|
|
|
(":Mac:Build:TE.prj", "TE.ppc"),
|
1997-05-06 13:15:32 -03:00
|
|
|
]),
|
|
|
|
|
|
|
|
I_68K_PLUGINS : (buildmwproject, "CWIE", [
|
2000-09-08 07:19:04 -03:00
|
|
|
(":Mac:Build:ucnhash.prj", "ucnhash.CFM68K"),
|
2000-07-07 10:08:09 -03:00
|
|
|
(":Mac:Build:ucnhash.prj", "ucnhash.CFM68K"),
|
1999-02-12 06:29:06 -04:00
|
|
|
(":Mac:Build:ctb.prj", "ctb.CFM68K"),
|
|
|
|
(":Mac:Build:gdbm.prj", "gdbm.CFM68K"),
|
|
|
|
(":Mac:Build:icglue.prj", "icglue.CFM68K"),
|
|
|
|
(":Mac:Build:waste.prj", "waste.CFM68K"),
|
|
|
|
(":Mac:Build:zlib.prj", "zlib.CFM68K"),
|
2000-04-23 19:13:15 -03:00
|
|
|
## (":Mac:Build:_tkinter.prj", "_tkinter.CFM68K"),
|
|
|
|
(":Extensions:Imaging:_tkinter.prj", "_tkinter.CFM68K"),
|
1999-02-12 06:29:06 -04:00
|
|
|
(":Mac:Build:ColorPicker.prj", "ColorPicker.CFM68K"),
|
|
|
|
(":Mac:Build:Printing.prj", "Printing.CFM68K"),
|
1999-03-04 19:00:11 -04:00
|
|
|
(":Mac:Build:App.prj", "App.CFM68K"),
|
1999-02-12 06:29:06 -04:00
|
|
|
(":Mac:Build:Cm.prj", "Cm.CFM68K"),
|
2000-04-08 18:29:31 -03:00
|
|
|
(":Mac:Build:Drag.prj", "Drag.CFM68K"),
|
1999-02-12 06:29:06 -04:00
|
|
|
(":Mac:Build:Fm.prj", "Fm.CFM68K"),
|
|
|
|
(":Mac:Build:Help.prj", "Help.CFM68K"),
|
|
|
|
(":Mac:Build:Icn.prj", "Icn.CFM68K"),
|
|
|
|
(":Mac:Build:List.prj", "List.CFM68K"),
|
1999-03-07 19:10:32 -04:00
|
|
|
(":Mac:Build:Qdoffs.prj", "Qdoffs.CFM68K"),
|
1999-02-12 06:29:06 -04:00
|
|
|
(":Mac:Build:Qt.prj", "Qt.CFM68K"),
|
|
|
|
(":Mac:Build:Scrap.prj", "Scrap.CFM68K"),
|
|
|
|
(":Mac:Build:Snd.prj", "Snd.CFM68K"),
|
|
|
|
(":Mac:Build:Sndihooks.prj", "Sndihooks.CFM68K"),
|
|
|
|
(":Mac:Build:TE.prj", "TE.CFM68K"),
|
1997-05-06 13:15:32 -03:00
|
|
|
]),
|
|
|
|
|
|
|
|
I_68K_FULL : (buildmwproject, "CWIE", [
|
1999-01-28 13:46:50 -04:00
|
|
|
(":Mac:Build:PythonStandalone.prj", "Python68K"),
|
1997-05-06 13:15:32 -03:00
|
|
|
]),
|
|
|
|
|
|
|
|
I_68K_SMALL : (buildmwproject, "CWIE", [
|
1999-01-28 13:46:50 -04:00
|
|
|
(":Mac:Build:PythonStandSmall.prj", "PythonSmall68K"),
|
1997-05-06 13:15:32 -03:00
|
|
|
]),
|
|
|
|
|
|
|
|
I_PPC_FULL : (buildmwproject, "CWIE", [
|
1999-01-28 13:46:50 -04:00
|
|
|
(":Mac:Build:PythonStandalone.prj", "PythonStandalone"),
|
1997-05-06 13:15:32 -03:00
|
|
|
]),
|
|
|
|
|
|
|
|
I_PPC_SMALL : (buildmwproject, "CWIE", [
|
1999-01-28 13:46:50 -04:00
|
|
|
(":Mac:Build:PythonStandSmall.prj", "PythonStandSmall"),
|
1997-05-06 13:15:32 -03:00
|
|
|
]),
|
|
|
|
|
|
|
|
I_PPC_EXTENSIONS : (buildmwproject, "CWIE", [
|
1997-08-27 11:10:29 -03:00
|
|
|
(":Extensions:Imaging:_imaging.prj", "_imaging.ppc"),
|
2000-04-23 19:13:15 -03:00
|
|
|
## (":Extensions:Imaging:_tkinter.prj", "_tkinter.ppc"),
|
1999-02-06 13:44:28 -04:00
|
|
|
(":Extensions:img:Mac:imgmodules.prj", "imgmodules PPC"),
|
1999-02-02 19:58:50 -04:00
|
|
|
(":Extensions:Numerical:Mac:numpymodules.prj", "multiarraymodule"),
|
|
|
|
(":Extensions:Numerical:Mac:numpymodules.prj", "_numpy"),
|
|
|
|
(":Extensions:Numerical:Mac:numpymodules.prj", "umathmodule"),
|
|
|
|
(":Extensions:Numerical:Mac:numpymodules.prj", "lapack_litemodule"),
|
|
|
|
(":Extensions:Numerical:Mac:numpymodules.prj", "ranlibmodule"),
|
1997-05-06 13:15:32 -03:00
|
|
|
]),
|
|
|
|
|
|
|
|
I_68K_EXTENSIONS : (buildmwproject, "CWIE", [
|
1997-08-27 11:10:29 -03:00
|
|
|
(":Extensions:Imaging:_imaging.prj", "_imaging.CFM68K"),
|
2000-04-23 19:13:15 -03:00
|
|
|
## (":Extensions:Imaging:_tkinter.prj", "_tkinter.CFM68K"),
|
1999-02-06 13:44:28 -04:00
|
|
|
(":Extensions:img:Mac:imgmodules.prj", "imgmodules CFM68K"),
|
1999-02-02 19:58:50 -04:00
|
|
|
## (":Extensions:NumPy:numpymodules.prj", "numpymodules.CFM68K"),
|
1997-05-06 13:15:32 -03:00
|
|
|
]),
|
|
|
|
|
|
|
|
I_APPLETS : (buildapplet, None, [
|
1999-01-31 21:21:18 -04:00
|
|
|
(":Mac:scripts:EditPythonPrefs.py", "EditPythonPrefs"),
|
|
|
|
(":Mac:scripts:BuildApplet.py", "BuildApplet"),
|
|
|
|
(":Mac:scripts:BuildApplication.py", "BuildApplication"),
|
|
|
|
(":Mac:scripts:ConfigurePython.py", "ConfigurePython"),
|
|
|
|
(":Mac:Tools:IDE:PythonIDE.py", "Python IDE"),
|
2000-03-28 16:50:36 -04:00
|
|
|
(":Mac:Tools:CGI:PythonCGISlave.py", ":Mac:Tools:CGI:PythonCGISlave"),
|
|
|
|
(":Mac:Tools:CGI:BuildCGIApplet.py", ":Mac:Tools:CGI:BuildCGIApplet"),
|
1997-05-06 13:15:32 -03:00
|
|
|
]),
|
|
|
|
}
|
1997-09-01 12:37:07 -03:00
|
|
|
|
|
|
|
def incbuildno(filename):
|
|
|
|
fp = open(filename)
|
|
|
|
line = fp.readline()
|
|
|
|
fp.close()
|
|
|
|
|
|
|
|
pat = regex.compile('#define BUILD \([0-9][0-9]*\)')
|
|
|
|
pat.match(line)
|
|
|
|
buildno = pat.group(1)
|
|
|
|
if not buildno:
|
|
|
|
raise 'Incorrect macbuildno.h line', line
|
|
|
|
new = string.atoi(buildno) + 1
|
|
|
|
fp = open(filename, 'w')
|
|
|
|
fp.write('#define BUILD %d\n'%new)
|
|
|
|
fp.close()
|
1995-09-01 09:03:32 -03:00
|
|
|
|
|
|
|
def main():
|
1997-05-06 13:15:32 -03:00
|
|
|
try:
|
2000-06-20 18:59:25 -03:00
|
|
|
h = Res.FSpOpenResFile('fullbuild.rsrc', 1)
|
1997-05-06 13:15:32 -03:00
|
|
|
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
|
|
|
|
1997-09-09 10:57:15 -03:00
|
|
|
todo = handle_dialog(os.path.join(dir, MACBUILDNO))
|
|
|
|
|
1997-05-06 13:15:32 -03:00
|
|
|
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()
|
|
|
|
|