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