| 1 | import sys, os, string, time, shutil |
| 2 | #import ReleaseForge |
| 3 | |
| 4 | from taskrunner import Job, Task, TaskRunner, Config |
| 5 | |
| 6 | # read in the build settings... |
| 7 | |
| 8 | CFGFILE = "./scripts/build-environ.cfg" |
| 9 | config = Config() |
| 10 | config.read(CFGFILE) |
| 11 | |
| 12 | config.WXWIN = os.path.abspath("..") |
| 13 | |
| 14 | class Job(Job): |
| 15 | LOGBASE = "./tmp" |
| 16 | |
| 17 | # ensure the staging area exists |
| 18 | if not os.path.exists(config.STAGING_DIR): |
| 19 | os.makedirs(config.STAGING_DIR) |
| 20 | |
| 21 | # Figure out the wxPython version number, possibly adjusted for being a daily build |
| 22 | if config.KIND == "daily": |
| 23 | t = time.localtime() |
| 24 | config.DAILY = time.strftime("%Y%m%d") # should it include the hour too? 2-digit year? |
| 25 | file("DAILY_BUILD", "w").write(config.DAILY) |
| 26 | # stamp the date on daily builds |
| 27 | config.BUILD_VERSION=config.BUILD_VERSION + "-" + config.DAILY |
| 28 | |
| 29 | # Let the user override build machine names, etc., etc. with their own |
| 30 | # config file settings |
| 31 | myconfig = None |
| 32 | myconfig_file = os.path.expanduser("~/wxrelease-environ.cfg") |
| 33 | if os.path.exists(myconfig_file): |
| 34 | myconfig = Config() |
| 35 | myconfig.read(myconfig_file) |
| 36 | |
| 37 | # TODO: Set up different environs for daily, release, etc. |
| 38 | # so that people can have different configs for different builds |
| 39 | |
| 40 | # prepare the environment file |
| 41 | config_env = config.asDict() |
| 42 | config_env.update(os.environ) |
| 43 | if myconfig: |
| 44 | config_env.update(myconfig.asDict()) |
| 45 | |
| 46 | tasks = Task([ Job("pre-flight", "./scripts/pre-flight.sh", env=config_env), |
| 47 | Job("win_build", "./scripts/build-windows.sh", env=config_env), |
| 48 | Job("lin_build", "./scripts/build-linux.sh", env=config_env), |
| 49 | Job("mac_build", "./scripts/build-mac.sh", env=config_env), |
| 50 | ]) |
| 51 | |
| 52 | print "Build getting started at: ", time.ctime() |
| 53 | |
| 54 | |
| 55 | # Run the first task, which will create the docs and sources tarballs |
| 56 | tr = TaskRunner(tasks) |
| 57 | rc = tr.run() |
| 58 | |
| 59 | if rc == 0 and config.delete_temps == "yes": |
| 60 | shutil.rmtree(config.WX_TEMP_DIR) |
| 61 | |
| 62 | # cleanup the DAILY_BUILD file |
| 63 | if config.KIND == "daily": |
| 64 | os.unlink("DAILY_BUILD") |
| 65 | |
| 66 | print "Build finished at: ", time.ctime() |
| 67 | sys.exit(0) |