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
|
2001-01-02 18:02:02 -04:00
|
|
|
import re
|
1997-09-01 12:37:07 -03:00
|
|
|
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
|
2001-01-03 07:12:21 -04:00
|
|
|
# label 3
|
|
|
|
I_PPC_EXTLIBS=4
|
|
|
|
I_GEN_PROJECTS=5
|
2001-01-21 18:25:11 -04:00
|
|
|
I_GEN_PROJECTS_FORCE=6
|
|
|
|
I_GEN_IMGPROJECTS=7
|
|
|
|
I_GEN_IMGPROJECTS_FORCE=8
|
|
|
|
I_INC_BUILDNO=9
|
|
|
|
# label 10
|
|
|
|
I_PPC_CORE=11
|
|
|
|
I_PPC_PLUGINS=12
|
|
|
|
I_PPC_EXTENSIONS=13
|
|
|
|
# label 14
|
|
|
|
I_CARBON_CORE=15
|
|
|
|
I_CARBON_PLUGINS=16
|
|
|
|
I_CARBON_EXTENSIONS=17
|
2001-02-12 10:46:53 -04:00
|
|
|
I_INTERPRETER=18
|
|
|
|
# label 19
|
|
|
|
I_PPC_FULL=20
|
|
|
|
I_PPC_SMALL=21
|
|
|
|
# label 22
|
|
|
|
I_CARBON_FULL=23
|
|
|
|
I_CARBON_SMALL=24
|
|
|
|
# label 25
|
|
|
|
I_APPLETS=26
|
2001-01-21 18:25:11 -04:00
|
|
|
|
2001-02-12 10:46:53 -04:00
|
|
|
N_BUTTONS=27
|
1997-08-27 11:10:29 -03:00
|
|
|
|
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)
|
2001-01-03 07:12:21 -04:00
|
|
|
except MacOS.Error:
|
1999-01-30 14:27:12 -04:00
|
|
|
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"""
|
2001-02-17 19:31:48 -04:00
|
|
|
for src, dst, tmpl in list:
|
|
|
|
template = buildtools.findtemplate(tmpl)
|
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
|
2001-02-17 19:31:48 -04:00
|
|
|
try:
|
|
|
|
buildtools.process(template, src, dst, 1)
|
|
|
|
except buildtools.BuildError, arg:
|
|
|
|
print '**', dst, arg
|
1997-05-06 13:15:32 -03:00
|
|
|
|
2001-01-21 18:25:11 -04:00
|
|
|
def buildprojectfile(top, arg, list):
|
2001-01-03 07:12:21 -04:00
|
|
|
"""Create CodeWarrior project files with a script"""
|
|
|
|
for folder, module, routine in list:
|
|
|
|
print "Generating project files with", module
|
|
|
|
sys.path.insert(0, os.path.join(top, folder))
|
|
|
|
m = __import__(module)
|
|
|
|
r = getattr(m, routine)
|
2001-01-21 18:25:11 -04:00
|
|
|
r(arg)
|
2001-01-03 07:12:21 -04:00
|
|
|
del sys.path[0]
|
|
|
|
|
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)
|
|
|
|
|
2001-02-12 10:46:53 -04:00
|
|
|
def buildcopy(top, dummy, list):
|
|
|
|
import macostools
|
|
|
|
for src, dst in list:
|
|
|
|
src = os.path.join(top, src)
|
|
|
|
dst = os.path.join(top, dst)
|
2001-03-06 18:46:25 -04:00
|
|
|
macostools.copy(src, dst, forcetype="APPL")
|
2001-02-12 10:46:53 -04:00
|
|
|
|
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 = {
|
2001-01-21 18:25:11 -04:00
|
|
|
I_GEN_PROJECTS : (buildprojectfile, 0, [
|
|
|
|
(":Mac:scripts", "genpluginprojects", "genallprojects")
|
|
|
|
]),
|
|
|
|
|
|
|
|
I_GEN_PROJECTS_FORCE : (buildprojectfile, 1, [
|
2001-01-03 07:12:21 -04:00
|
|
|
(":Mac:scripts", "genpluginprojects", "genallprojects")
|
|
|
|
]),
|
|
|
|
|
2001-01-21 18:25:11 -04:00
|
|
|
I_GEN_IMGPROJECTS : (buildprojectfile, 0, [
|
2001-01-03 07:12:21 -04:00
|
|
|
(":Extensions:img:Mac", "genimgprojects", "genallprojects")
|
|
|
|
]),
|
|
|
|
|
2001-01-21 18:25:11 -04:00
|
|
|
I_GEN_IMGPROJECTS_FORCE : (buildprojectfile, 1, [
|
|
|
|
(":Extensions:img:Mac", "genimgprojects", "genallprojects")
|
|
|
|
]),
|
|
|
|
|
2001-02-12 10:46:53 -04:00
|
|
|
I_INTERPRETER : (buildcopy, None, [
|
|
|
|
("PythonInterpreterCarbon", "PythonInterpreter"),
|
|
|
|
]),
|
|
|
|
|
2001-01-21 18:25:11 -04:00
|
|
|
I_PPC_CORE : (buildmwproject, "CWIE", [
|
2000-12-03 18:36:42 -04:00
|
|
|
(":Mac:Build:PythonCore.mcp", "PythonCore"),
|
2001-02-12 10:46:53 -04:00
|
|
|
(":Mac:Build:PythonInterpreter.mcp", "PythonInterpreterClassic"),
|
1997-05-06 13:15:32 -03:00
|
|
|
]),
|
|
|
|
|
2001-01-21 18:25:11 -04:00
|
|
|
I_CARBON_CORE : (buildmwproject, "CWIE", [
|
|
|
|
(":Mac:Build:PythonCore.mcp", "PythonCoreCarbon"),
|
|
|
|
(":Mac:Build:PythonInterpreter.mcp", "PythonInterpreterCarbon"),
|
|
|
|
]),
|
|
|
|
|
2001-01-03 07:12:21 -04:00
|
|
|
I_PPC_EXTLIBS : (buildmwproject, "CWIE", [
|
|
|
|
## (":Mac:Build:buildlibs.mcp", "buildlibs ppc plus tcl/tk"),
|
|
|
|
(":Mac:Build:buildlibs.mcp", "buildlibs ppc"),
|
|
|
|
]),
|
|
|
|
|
1997-05-06 13:15:32 -03:00
|
|
|
I_PPC_PLUGINS : (buildmwproject, "CWIE", [
|
2001-02-12 10:46:53 -04:00
|
|
|
(":Mac:Build:_weakref.mcp", "_weakref.ppc"),
|
|
|
|
(":Mac:Build:_symtable.mcp", "_symtable.ppc"),
|
|
|
|
(":Mac:Build:_testcapi.mcp", "_testcapi.ppc"),
|
2000-12-03 18:36:42 -04:00
|
|
|
(":Mac:Build:pyexpat.mcp", "pyexpat.ppc"),
|
|
|
|
(":Mac:Build:calldll.mcp", "calldll.ppc"),
|
|
|
|
(":Mac:Build:ctb.mcp", "ctb.ppc"),
|
|
|
|
(":Mac:Build:gdbm.mcp", "gdbm.ppc"),
|
|
|
|
(":Mac:Build:icglue.mcp", "icglue.ppc"),
|
|
|
|
(":Mac:Build:macspeech.mcp", "macspeech.ppc"),
|
|
|
|
(":Mac:Build:waste.mcp", "waste.ppc"),
|
|
|
|
(":Mac:Build:zlib.mcp", "zlib.ppc"),
|
|
|
|
## (":Mac:Build:_tkinter.mcp", "_tkinter.ppc"),
|
2001-01-01 17:51:33 -04:00
|
|
|
(":Extensions:Imaging:_tkinter.mcp", "_tkinter.ppc"),
|
2000-12-03 18:36:42 -04:00
|
|
|
(":Mac:Build:ColorPicker.mcp", "ColorPicker.ppc"),
|
|
|
|
(":Mac:Build:Printing.mcp", "Printing.ppc"),
|
|
|
|
(":Mac:Build:App.mcp", "App.ppc"),
|
|
|
|
(":Mac:Build:Cm.mcp", "Cm.ppc"),
|
|
|
|
(":Mac:Build:Fm.mcp", "Fm.ppc"),
|
|
|
|
(":Mac:Build:Help.mcp", "Help.ppc"),
|
|
|
|
(":Mac:Build:Icn.mcp", "Icn.ppc"),
|
|
|
|
(":Mac:Build:List.mcp", "List.ppc"),
|
|
|
|
(":Mac:Build:Qdoffs.mcp", "Qdoffs.ppc"),
|
|
|
|
(":Mac:Build:Qt.mcp", "Qt.ppc"),
|
|
|
|
(":Mac:Build:Scrap.mcp", "Scrap.ppc"),
|
|
|
|
(":Mac:Build:Snd.mcp", "Snd.ppc"),
|
|
|
|
(":Mac:Build:Sndihooks.mcp", "Sndihooks.ppc"),
|
|
|
|
(":Mac:Build:TE.mcp", "TE.ppc"),
|
2001-07-16 19:04:08 -03:00
|
|
|
(":Mac:Build:Mlte.mcp", "Mlte.ppc"),
|
1997-05-06 13:15:32 -03:00
|
|
|
]),
|
|
|
|
|
2001-01-23 18:36:52 -04:00
|
|
|
I_CARBON_PLUGINS : (buildmwproject, "CWIE", [
|
2001-02-12 10:46:53 -04:00
|
|
|
(":Mac:Build:_weakref.carbon.mcp", "_weakref.carbon"),
|
|
|
|
(":Mac:Build:_symtable.carbon.mcp", "_symtable.carbon"),
|
|
|
|
(":Mac:Build:_testcapi.carbon.mcp", "_testcapi.carbon"),
|
2001-01-23 18:36:52 -04:00
|
|
|
(":Mac:Build:pyexpat.carbon.mcp", "pyexpat.carbon"),
|
|
|
|
(":Mac:Build:calldll.carbon.mcp", "calldll.carbon"),
|
|
|
|
(":Mac:Build:gdbm.carbon.mcp", "gdbm.carbon"),
|
2001-01-29 09:27:46 -04:00
|
|
|
(":Mac:Build:icglue.carbon.mcp", "icglue.carbon"),
|
2001-01-24 12:02:07 -04:00
|
|
|
(":Mac:Build:waste.carbon.mcp", "waste.carbon"),
|
2001-01-23 18:36:52 -04:00
|
|
|
(":Mac:Build:zlib.carbon.mcp", "zlib.carbon"),
|
2001-03-20 19:30:06 -04:00
|
|
|
(":Mac:Build:_dummy_tkinter.mcp", "_tkinter.carbon"),
|
2001-01-23 18:36:52 -04:00
|
|
|
## (":Extensions:Imaging:_tkinter.carbon.mcp", "_tkinter.carbon"),
|
|
|
|
(":Mac:Build:ColorPicker.carbon.mcp", "ColorPicker.carbon"),
|
|
|
|
(":Mac:Build:App.carbon.mcp", "App.carbon"),
|
|
|
|
(":Mac:Build:Cm.carbon.mcp", "Cm.carbon"),
|
|
|
|
(":Mac:Build:Fm.carbon.mcp", "Fm.carbon"),
|
|
|
|
(":Mac:Build:Icn.carbon.mcp", "Icn.carbon"),
|
|
|
|
(":Mac:Build:List.carbon.mcp", "List.carbon"),
|
|
|
|
(":Mac:Build:Qdoffs.carbon.mcp", "Qdoffs.carbon"),
|
|
|
|
(":Mac:Build:Qt.carbon.mcp", "Qt.carbon"),
|
2001-01-24 12:02:07 -04:00
|
|
|
(":Mac:Build:Scrap.carbon.mcp", "Scrap.carbon"),
|
2001-01-23 18:36:52 -04:00
|
|
|
(":Mac:Build:Snd.carbon.mcp", "Snd.carbon"),
|
|
|
|
(":Mac:Build:Sndihooks.carbon.mcp", "Sndihooks.carbon"),
|
|
|
|
(":Mac:Build:TE.carbon.mcp", "TE.carbon"),
|
2001-06-26 18:52:08 -03:00
|
|
|
|
|
|
|
(":Mac:Build:CF.carbon.mcp", "CF.carbon"),
|
2001-07-13 17:57:47 -03:00
|
|
|
(":Mac:Build:Mlte.carbon.mcp", "Mlte.carbon"),
|
2001-01-23 18:36:52 -04:00
|
|
|
]),
|
1997-05-06 13:15:32 -03:00
|
|
|
|
2001-01-24 10:06:35 -04:00
|
|
|
I_PPC_FULL : (buildmwproject, "CWIE", [
|
|
|
|
(":Mac:Build:PythonStandalone.mcp", "PythonStandalone"),
|
|
|
|
]),
|
|
|
|
|
1997-05-06 13:15:32 -03:00
|
|
|
I_PPC_SMALL : (buildmwproject, "CWIE", [
|
2000-12-03 18:36:42 -04:00
|
|
|
(":Mac:Build:PythonStandSmall.mcp", "PythonStandSmall"),
|
1997-05-06 13:15:32 -03:00
|
|
|
]),
|
|
|
|
|
2001-02-12 10:46:53 -04:00
|
|
|
I_CARBON_FULL : (buildmwproject, "CWIE", [
|
|
|
|
(":Mac:Build:PythonStandalone.mcp", "PythonCarbonStandalone"),
|
|
|
|
]),
|
|
|
|
|
|
|
|
I_CARBON_SMALL : (buildmwproject, "CWIE", [
|
|
|
|
(":Mac:Build:PythonStandSmall.mcp", "PythonStandSmallCarbon"),
|
|
|
|
]),
|
|
|
|
|
1997-05-06 13:15:32 -03:00
|
|
|
I_PPC_EXTENSIONS : (buildmwproject, "CWIE", [
|
2000-12-03 18:36:42 -04:00
|
|
|
(":Extensions:Imaging:_imaging.mcp", "_imaging.ppc"),
|
|
|
|
## (":Extensions:Imaging:_tkinter.mcp", "_tkinter.ppc"),
|
2001-01-23 19:19:41 -04:00
|
|
|
(":Extensions:img:Mac:imgmodules.mcp", "imgmodules.ppc"),
|
1997-05-06 13:15:32 -03:00
|
|
|
]),
|
|
|
|
|
2001-01-23 19:19:41 -04:00
|
|
|
I_CARBON_EXTENSIONS : (buildmwproject, "CWIE", [
|
2001-03-01 19:15:01 -04:00
|
|
|
(":Extensions:Imaging:_imaging.mcp", "_imaging.carbon"),
|
2001-01-23 19:19:41 -04:00
|
|
|
## (":Extensions:Imaging:_tkinter.mcp", "_tkinter.carbon"),
|
|
|
|
(":Extensions:img:Mac:imgmodules.mcp", "imgmodules.carbon"),
|
|
|
|
]),
|
|
|
|
|
1997-05-06 13:15:32 -03:00
|
|
|
I_APPLETS : (buildapplet, None, [
|
2001-02-17 19:31:48 -04:00
|
|
|
(":Mac:scripts:EditPythonPrefs.py", "EditPythonPrefs", None),
|
|
|
|
(":Mac:scripts:BuildApplet.py", "BuildApplet", None),
|
|
|
|
(":Mac:scripts:BuildApplication.py", "BuildApplication", None),
|
|
|
|
(":Mac:scripts:ConfigurePython.py", "ConfigurePython", None),
|
|
|
|
(":Mac:scripts:ConfigurePython.py", "ConfigurePythonCarbon", "PythonInterpreterCarbon"),
|
|
|
|
(":Mac:scripts:ConfigurePython.py", "ConfigurePythonClassic", "PythonInterpreterClassic"),
|
|
|
|
(":Mac:Tools:IDE:PythonIDE.py", "Python IDE", None),
|
|
|
|
(":Mac:Tools:CGI:PythonCGISlave.py", ":Mac:Tools:CGI:PythonCGISlave", None),
|
|
|
|
(":Mac:Tools:CGI:BuildCGIApplet.py", ":Mac:Tools:CGI:BuildCGIApplet", None),
|
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()
|
|
|
|
|
2001-01-02 18:02:02 -04:00
|
|
|
pat = re.compile('#define BUILD ([0-9]+)')
|
|
|
|
m = pat.search(line)
|
|
|
|
if not m or not m.group(1):
|
1997-09-01 12:37:07 -03:00
|
|
|
raise 'Incorrect macbuildno.h line', line
|
2001-01-02 18:02:02 -04:00
|
|
|
buildno = m.group(1)
|
1997-09-01 12:37:07 -03:00
|
|
|
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
|
|
|
|
2001-01-03 07:12:21 -04:00
|
|
|
if todo:
|
|
|
|
print "All done!"
|
1995-09-01 09:03:32 -03:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|
|
|
|
|