]> git.saurik.com Git - wxWidgets.git/blame - wxPython/distrib/all/build-all
unused var warning in Mac build
[wxWidgets.git] / wxPython / distrib / all / build-all
CommitLineData
2bf6b425 1#!/usr/bin/python -u
e4bb5998
RD
2#----------------------------------------------------------------------
3# Name: build-all.py
4# Purpose: Master build script for building all the installers and
5# such on all the build machines in my lab, and then
6# distributing the results as needed.
7#
8# This will replace the build-all bash script and is
9# needed because the needs of the build have outgrown
10# what I can do with bash.
11#
12# Author: Robin Dunn
13#
14# Created: 05-Nov-2004
15# RCS-ID: $Id$
16# Copyright: (c) 2004 by Total Control Software
17# Licence: wxWindows license
18#----------------------------------------------------------------------
19
20import sys
21import os
22import time
23from taskrunner import Job, Task, TaskRunner
24
25#----------------------------------------------------------------------
26# Configuration items
27
28class Config:
29 def write(self, filename="config", outfile=None):
30 if outfile is None:
31 f = file(filename, "w")
32 else:
33 f = outfile
34 for k, v in self.__dict__.items():
35 f.write('%s="%s"\n' % (k, v))
36
37config = Config()
36e91097
RD
38
39# the local spot that we put everything when done, before possibly copying
40# to remote hosts
e4bb5998 41config.STAGING_DIR = "./BUILD"
36e91097 42
36e91097 43
d6624155 44# host name of the machine to use for windows builds
e4bb5998 45config.WIN_HOST = "beast"
d6624155 46# Where is the build dir from the remote machine's perspective?
e4bb5998 47config.WIN_BUILD = "/c/BUILD"
36e91097
RD
48
49
d6624155 50# Just like the above
e4bb5998
RD
51config.OSX_HOST_panther = "bigmac"
52config.OSX_HOST_jaguar = "whopper"
53config.OSX_BUILD = "/BUILD"
36e91097
RD
54
55
afbe4a55 56# Alsmost the same... See below for hosts and other info
e4bb5998 57config.LINUX_BUILD = "/tmp/BUILD"
36e91097
RD
58
59
60# Upload server locations
e4bb5998
RD
61config.UPLOAD_HOST = "starship.python.net"
62config.UPLOAD_DAILY_ROOT = "/home/crew/robind/public_html/wxPython/daily"
2cc3f6a0 63config.UPLOAD_PREVIEW_ROOT = "/home/crew/robind/public_html/wxPython/rc"
e4bb5998
RD
64
65# defaults for build options
66config.KIND = "dryrun"
e4bb5998
RD
67config.skipsource = "no"
68config.onlysource = "no"
69config.skipdocs = "no"
70config.skipwin = "no"
71config.skiposx = "no"
72config.skiplinux = "no"
73config.skipclean = "no"
74config.skipupload = "no"
75config.skipnewdocs = "no"
2bf6b425 76config.startcohost = "yes"
e4bb5998
RD
77
78#----------------------------------------------------------------------
79# Define all the build tasks
80
81class Job(Job):
82 LOGBASE = "./tmp"
83
84CFGFILE = "./tmp/config"
85
86
87# Things that need to be done before any of the builds
88initialTask = Task([ Job("", ["distrib/all/build-setup", CFGFILE]),
89 Job("", ["distrib/all/build-docs", CFGFILE]),
90 Job("", ["distrib/all/build-sources", CFGFILE]),
91 ])
92
93# Build tasks. Anything that can be done in parallel (depends greatly
e47b49b2 94# on the nature of the build machines configurations...) is a separate
e4bb5998 95# task.
e4bb5998 96
0bcec691 97jaguarTask = Task( Job("whopper.23",
2bf6b425 98 ["distrib/all/build-osx", CFGFILE, config.OSX_HOST_jaguar, "jaguar", "2.3"]) )
e4bb5998 99
0bcec691
RD
100pantherTask = Task([ Job("bigmac.23",
101 ["distrib/all/build-osx", CFGFILE, config.OSX_HOST_panther, "panther", "2.3"]),
102 Job("bigmac.24",
103 ["distrib/all/build-osx", CFGFILE, config.OSX_HOST_panther, "panther", "2.4"])
104 ])
2bf6b425 105
4afab8bd 106beastTask1 = Task([ Job("beast.23", ["distrib/all/build-windows", CFGFILE, "2.3"]),
818f9442 107 Job("beast.24", ["distrib/all/build-windows", CFGFILE, "2.4"]),
afd954d8 108 Job("co-mdk102.24", ["distrib/all/build-rpm", CFGFILE, "beast", "co-mdk102","mdk102","2.4"]),
2bf6b425
RD
109 ])
110
948ee5ea
RD
111beastTask2 = Task([ Job("co-fc2.23", ["distrib/all/build-rpm", CFGFILE, "beast", "co-fc2", "fc2", "2.3"]),
112 Job("co-mdk101.23", ["distrib/all/build-rpm", CFGFILE, "beast", "co-mdk101","mdk101","2.3"]),
2bf6b425 113 Job("co-fc2.24", ["distrib/all/build-rpm", CFGFILE, "beast", "co-fc2", "fc2", "2.4"]),
948ee5ea 114 #Job("co-mdk101.24", ["distrib/all/build-rpm", CFGFILE, "beast", "co-mdk101","mdk101","2.4"]),
2bf6b425
RD
115 ])
116
cbb07700
RD
117cyclopsTask = Task([ Job("co-mdk92.23", ["distrib/all/build-rpm", CFGFILE, "cyclops", "co-mdk92", "mdk92", "2.3"]),
118 Job("co-rh9.23", ["distrib/all/build-rpm", CFGFILE, "cyclops", "co-rh9", "rh9", "2.3"]),
818f9442 119 Job("co-mdk92.24", ["distrib/all/build-rpm", CFGFILE, "cyclops", "co-mdk92", "mdk92", "2.4"]),
cbb07700 120 Job("co-rh9.24", ["distrib/all/build-rpm", CFGFILE, "cyclops", "co-rh9", "rh9", "2.4"]),
818f9442 121 ])
4afab8bd 122
2bf6b425 123buildTasks = [ jaguarTask,
e4bb5998 124 pantherTask,
2bf6b425
RD
125 beastTask1,
126 beastTask2,
818f9442 127 cyclopsTask,
e4bb5998
RD
128 ]
129
130# Finalization. This is for things that must wait until all the
dc5bee0a 131# builds are done, such as copying the installers someplace, sending
e4bb5998
RD
132# emails, etc.
133finalizationTask = Task( Job("", ["distrib/all/build-finalize", CFGFILE]) )
134
135
136#----------------------------------------------------------------------
137
138def usage():
139 print ""
140 print "Usage: build-all [command flags...]"
141 print ""
142 print "build types:"
143 print " dryrun Do the build, but don't copy anywhere (default)"
144 print " daily Do a daily build, copy to starship"
145 print " release Do a normal release (cantidate) build, copy to starship"
146 print ""
147 print "optional command flags:"
e4bb5998
RD
148 print " skipsource Don't build the source archives, use the ones"
149 print " already in the staging dir."
150 print " onlysource Exit after building the source and docs archives"
151 print " skipdocs Don't rebuild the docs"
152 print " skipwin Don't do the remote Windows build"
153 print " skiposx Don't do the remote OSX build"
154 print " skiplinux Don't do the remote Linux build"
155 print " skipclean Don't do the cleanup step on the remote builds"
156 print " skipupload Don't upload the builds to starship"
157 print ""
2bf6b425
RD
158 print " nocohost Don't start the coLinux sessions if they are"
159 print " not already online"
160 print ""
36e91097 161
36e91097 162
e4bb5998
RD
163#----------------------------------------------------------------------
164
165def main(args):
166 # Make sure we are running in the right directory. TODO: make
167 # this test more robust. Currenly we just test for the presence
168 # of 'wxPython' and 'wx' subdirs.
169 if not os.path.isdir("wxPython") or not os.path.isdir("wx"):
170 print "Please run this script from the root wxPython directory."
171 sys.exit(1)
172
173 # Check command line flags
174 for flag in args:
175 if flag in ["dryrun", "daily", "release"]:
176 config.KIND = flag
177
e4bb5998
RD
178 elif flag == "skipsource":
179 config.skipsource = "yes"
180
181 elif flag == "onlysource":
182 config.onlysource = "yes"
183
184 elif flag == "skipdocs":
185 config.skipdocs = "yes"
186
187 elif flag == "skipnewdocs":
188 config.skipnewdocs = "yes"
189
190 elif flag == "skipwin":
191 config.skipwin = "yes"
192
193 elif flag == "skiposx":
194 config.skiposx = "yes"
195
196 elif flag == "skiplinux":
197 config.skiplinux = "yes"
198
199 elif flag == "skipclean":
200 config.skipclean = "yes"
201
202 elif flag == "skipupload":
203 config.skipupload = "yes"
2bf6b425
RD
204
205 elif flag == "nocohost":
206 config.startcohost = "no"
e4bb5998
RD
207
208 else:
209 print 'Unknown flag: "%s"' % flag
210 usage()
211 sys.exit(2)
212
213
214 # ensure the staging area exists
215 if not os.path.exists(config.STAGING_DIR):
216 os.makedirs(config.STAGING_DIR)
217
218 # Figure out the wxPython version number, possibly adjusted for being a daily build
219 if config.KIND == "daily":
220 t = time.localtime()
221 config.DAILY = time.strftime("%Y%m%d") # should it include the hour too? 2-digit year?
222 file("DAILY_BUILD", "w").write(config.DAILY)
223 sys.path.append('.')
224 import setup
225 config.VERSION = setup.VERSION
226
227 # write the config file where the build scripts can find it
228 config.write(CFGFILE)
229 print "Build getting started at: ", time.ctime()
230
231
232 # Run the first task, which will create the docs and sources tarballs
233 tr = TaskRunner(initialTask)
234 rc = tr.run()
235
236 # cleanup the DAILY_BUILD file
237 if config.KIND == "daily":
238 os.unlink("DAILY_BUILD")
239
240 # Quit now?
241 if rc != 0 or config.onlysource == "yes":
242 sys.exit(rc)
243
244
245 # Run the main build tasks
246 tr = TaskRunner(buildTasks)
247 rc = tr.run()
248 if rc != 0:
249 sys.exit(rc)
250
251
252 # when all the builds are done, run the finalization task
253 tr = TaskRunner(finalizationTask)
254 rc = tr.run()
255 if rc != 0:
256 sys.exit(rc)
5df4dd4b 257
e4bb5998
RD
258
259 print "Build finished at: ", time.ctime()
260 sys.exit(0)
7dc107d6 261
7dc107d6 262
36e91097
RD
263
264
e4bb5998
RD
265if __name__ == "__main__":
266 main(sys.argv[1:])