]> git.saurik.com Git - wxWidgets.git/blame - wxPython/distrib/all/build-all
Added GetCount, GetCountRGB, and GetCountColour methods to
[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"
63config.UPLOAD_PREVIEW_ROOT = "/home/crew/robind/public_html/wxPython/preview"
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
94# on the nature of the build machine configurations...) is a separate
95# task.
e4bb5998
RD
96
97jaguarTask = Task( Job(config.OSX_HOST_jaguar,
2bf6b425 98 ["distrib/all/build-osx", CFGFILE, config.OSX_HOST_jaguar, "jaguar", "2.3"]) )
e4bb5998
RD
99
100pantherTask = Task( Job(config.OSX_HOST_panther,
2bf6b425
RD
101 ["distrib/all/build-osx", CFGFILE, config.OSX_HOST_panther, "panther", "2.3"]) )
102
4afab8bd 103beastTask1 = Task([ Job("beast.23", ["distrib/all/build-windows", CFGFILE, "2.3"]),
2bf6b425 104 Job("co-rh9.23", ["distrib/all/build-rpm", CFGFILE, "beast", "co-rh9", "rh9", "2.3"]),
4afab8bd 105 Job("co-mdk92.23", ["distrib/all/build-rpm", CFGFILE, "beast", "co-mdk92", "mdk92", "2.3"]),
2bf6b425 106 Job("co-rh9.24", ["distrib/all/build-rpm", CFGFILE, "beast", "co-rh9", "rh9", "2.4"]),
4afab8bd 107 Job("co-mdk92.24", ["distrib/all/build-rpm", CFGFILE, "beast", "co-mdk92", "mdk92", "2.4"]),
2bf6b425
RD
108 ])
109
4afab8bd 110beastTask2 = Task([ Job("co-mdk101.23", ["distrib/all/build-rpm", CFGFILE, "beast", "co-mdk101","mdk101","2.3"]),
2bf6b425 111 Job("co-fc2.23", ["distrib/all/build-rpm", CFGFILE, "beast", "co-fc2", "fc2", "2.3"]),
2bf6b425
RD
112 Job("co-mdk101.24", ["distrib/all/build-rpm", CFGFILE, "beast", "co-mdk101","mdk101","2.4"]),
113 Job("co-fc2.24", ["distrib/all/build-rpm", CFGFILE, "beast", "co-fc2", "fc2", "2.4"]),
4afab8bd 114 Job("beast.24", ["distrib/all/build-windows", CFGFILE, "2.4"]),
2bf6b425
RD
115 ])
116
4afab8bd 117
2bf6b425 118buildTasks = [ jaguarTask,
e4bb5998 119 pantherTask,
2bf6b425
RD
120 beastTask1,
121 beastTask2,
e4bb5998
RD
122 ]
123
124# Finalization. This is for things that must wait until all the
dc5bee0a 125# builds are done, such as copying the installers someplace, sending
e4bb5998
RD
126# emails, etc.
127finalizationTask = Task( Job("", ["distrib/all/build-finalize", CFGFILE]) )
128
129
130#----------------------------------------------------------------------
131
132def usage():
133 print ""
134 print "Usage: build-all [command flags...]"
135 print ""
136 print "build types:"
137 print " dryrun Do the build, but don't copy anywhere (default)"
138 print " daily Do a daily build, copy to starship"
139 print " release Do a normal release (cantidate) build, copy to starship"
140 print ""
141 print "optional command flags:"
e4bb5998
RD
142 print " skipsource Don't build the source archives, use the ones"
143 print " already in the staging dir."
144 print " onlysource Exit after building the source and docs archives"
145 print " skipdocs Don't rebuild the docs"
146 print " skipwin Don't do the remote Windows build"
147 print " skiposx Don't do the remote OSX build"
148 print " skiplinux Don't do the remote Linux build"
149 print " skipclean Don't do the cleanup step on the remote builds"
150 print " skipupload Don't upload the builds to starship"
151 print ""
2bf6b425
RD
152 print " nocohost Don't start the coLinux sessions if they are"
153 print " not already online"
154 print ""
36e91097 155
36e91097 156
e4bb5998
RD
157#----------------------------------------------------------------------
158
159def main(args):
160 # Make sure we are running in the right directory. TODO: make
161 # this test more robust. Currenly we just test for the presence
162 # of 'wxPython' and 'wx' subdirs.
163 if not os.path.isdir("wxPython") or not os.path.isdir("wx"):
164 print "Please run this script from the root wxPython directory."
165 sys.exit(1)
166
167 # Check command line flags
168 for flag in args:
169 if flag in ["dryrun", "daily", "release"]:
170 config.KIND = flag
171
e4bb5998
RD
172 elif flag == "skipsource":
173 config.skipsource = "yes"
174
175 elif flag == "onlysource":
176 config.onlysource = "yes"
177
178 elif flag == "skipdocs":
179 config.skipdocs = "yes"
180
181 elif flag == "skipnewdocs":
182 config.skipnewdocs = "yes"
183
184 elif flag == "skipwin":
185 config.skipwin = "yes"
186
187 elif flag == "skiposx":
188 config.skiposx = "yes"
189
190 elif flag == "skiplinux":
191 config.skiplinux = "yes"
192
193 elif flag == "skipclean":
194 config.skipclean = "yes"
195
196 elif flag == "skipupload":
197 config.skipupload = "yes"
2bf6b425
RD
198
199 elif flag == "nocohost":
200 config.startcohost = "no"
e4bb5998
RD
201
202 else:
203 print 'Unknown flag: "%s"' % flag
204 usage()
205 sys.exit(2)
206
207
208 # ensure the staging area exists
209 if not os.path.exists(config.STAGING_DIR):
210 os.makedirs(config.STAGING_DIR)
211
212 # Figure out the wxPython version number, possibly adjusted for being a daily build
213 if config.KIND == "daily":
214 t = time.localtime()
215 config.DAILY = time.strftime("%Y%m%d") # should it include the hour too? 2-digit year?
216 file("DAILY_BUILD", "w").write(config.DAILY)
217 sys.path.append('.')
218 import setup
219 config.VERSION = setup.VERSION
220
221 # write the config file where the build scripts can find it
222 config.write(CFGFILE)
223 print "Build getting started at: ", time.ctime()
224
225
226 # Run the first task, which will create the docs and sources tarballs
227 tr = TaskRunner(initialTask)
228 rc = tr.run()
229
230 # cleanup the DAILY_BUILD file
231 if config.KIND == "daily":
232 os.unlink("DAILY_BUILD")
233
234 # Quit now?
235 if rc != 0 or config.onlysource == "yes":
236 sys.exit(rc)
237
238
239 # Run the main build tasks
240 tr = TaskRunner(buildTasks)
241 rc = tr.run()
242 if rc != 0:
243 sys.exit(rc)
244
245
246 # when all the builds are done, run the finalization task
247 tr = TaskRunner(finalizationTask)
248 rc = tr.run()
249 if rc != 0:
250 sys.exit(rc)
5df4dd4b 251
e4bb5998
RD
252
253 print "Build finished at: ", time.ctime()
254 sys.exit(0)
7dc107d6 255
7dc107d6 256
36e91097
RD
257
258
e4bb5998
RD
259if __name__ == "__main__":
260 main(sys.argv[1:])