Adding code to load Config objects from a file, and move to modifying environment variables rather than sourcing the config file (so that every script is not required to do this).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37744 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -20,60 +20,14 @@
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from taskrunner import Job, Task, TaskRunner
|
from taskrunner import Job, Task, TaskRunner, Config
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# Configuration items
|
# Configuration items
|
||||||
|
|
||||||
class Config:
|
CFGFILE = "./distrib/all/build-environ.cfg"
|
||||||
def write(self, filename="config", outfile=None):
|
|
||||||
if outfile is None:
|
|
||||||
f = file(filename, "w")
|
|
||||||
else:
|
|
||||||
f = outfile
|
|
||||||
for k, v in self.__dict__.items():
|
|
||||||
f.write('%s="%s"\n' % (k, v))
|
|
||||||
|
|
||||||
config = Config()
|
config = Config()
|
||||||
|
config.read(CFGFILE)
|
||||||
# the local spot that we put everything when done, before possibly copying
|
|
||||||
# to remote hosts
|
|
||||||
config.STAGING_DIR = "./BUILD"
|
|
||||||
|
|
||||||
|
|
||||||
# host name of the machine to use for windows builds
|
|
||||||
config.WIN_HOST = "beast"
|
|
||||||
# Where is the build dir from the remote machine's perspective?
|
|
||||||
config.WIN_BUILD = "/c/BUILD"
|
|
||||||
|
|
||||||
|
|
||||||
# Just like the above
|
|
||||||
config.OSX_HOST_panther = "bigmac"
|
|
||||||
config.OSX_HOST_jaguar = "whopper"
|
|
||||||
config.OSX_BUILD = "/BUILD"
|
|
||||||
|
|
||||||
|
|
||||||
# Alsmost the same... See below for hosts and other info
|
|
||||||
config.LINUX_BUILD = "/tmp/BUILD"
|
|
||||||
|
|
||||||
|
|
||||||
# Upload server locations
|
|
||||||
config.UPLOAD_HOST = "starship.python.net"
|
|
||||||
config.UPLOAD_DAILY_ROOT = "/home/crew/robind/public_html/wxPython/daily"
|
|
||||||
config.UPLOAD_PREVIEW_ROOT = "/home/crew/robind/public_html/wxPython/rc"
|
|
||||||
|
|
||||||
# defaults for build options
|
|
||||||
config.KIND = "dryrun"
|
|
||||||
config.skipsource = "no"
|
|
||||||
config.onlysource = "no"
|
|
||||||
config.skipdocs = "no"
|
|
||||||
config.skipwin = "no"
|
|
||||||
config.skiposx = "no"
|
|
||||||
config.skiplinux = "no"
|
|
||||||
config.skipclean = "no"
|
|
||||||
config.skipupload = "no"
|
|
||||||
config.skipnewdocs = "no"
|
|
||||||
config.startcohost = "yes"
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# Define all the build tasks
|
# Define all the build tasks
|
||||||
@@ -81,58 +35,6 @@ config.startcohost = "yes"
|
|||||||
class Job(Job):
|
class Job(Job):
|
||||||
LOGBASE = "./tmp"
|
LOGBASE = "./tmp"
|
||||||
|
|
||||||
CFGFILE = "./tmp/config"
|
|
||||||
|
|
||||||
|
|
||||||
# Things that need to be done before any of the builds
|
|
||||||
initialTask = Task([ Job("", ["distrib/all/build-setup", CFGFILE]),
|
|
||||||
Job("", ["distrib/all/build-docs", CFGFILE]),
|
|
||||||
Job("", ["distrib/all/build-sources", CFGFILE]),
|
|
||||||
])
|
|
||||||
|
|
||||||
# Build tasks. Anything that can be done in parallel (depends greatly
|
|
||||||
# on the nature of the build machines configurations...) is a separate
|
|
||||||
# task.
|
|
||||||
|
|
||||||
jaguarTask = Task( Job("whopper.23",
|
|
||||||
["distrib/all/build-osx", CFGFILE, config.OSX_HOST_jaguar, "jaguar", "2.3"]) )
|
|
||||||
|
|
||||||
pantherTask = Task([ Job("bigmac.23",
|
|
||||||
["distrib/all/build-osx", CFGFILE, config.OSX_HOST_panther, "panther", "2.3"]),
|
|
||||||
Job("bigmac.24",
|
|
||||||
["distrib/all/build-osx", CFGFILE, config.OSX_HOST_panther, "panther", "2.4"])
|
|
||||||
])
|
|
||||||
|
|
||||||
beastTask1 = Task([ Job("beast.23", ["distrib/all/build-windows", CFGFILE, "2.3"]),
|
|
||||||
Job("beast.24", ["distrib/all/build-windows", CFGFILE, "2.4"]),
|
|
||||||
Job("co-mdk102.24", ["distrib/all/build-rpm", CFGFILE, "beast", "co-mdk102","mdk102","2.4"]),
|
|
||||||
])
|
|
||||||
|
|
||||||
beastTask2 = Task([ Job("co-fc2.23", ["distrib/all/build-rpm", CFGFILE, "beast", "co-fc2", "fc2", "2.3"]),
|
|
||||||
Job("co-mdk101.23", ["distrib/all/build-rpm", CFGFILE, "beast", "co-mdk101","mdk101","2.3"]),
|
|
||||||
Job("co-fc2.24", ["distrib/all/build-rpm", CFGFILE, "beast", "co-fc2", "fc2", "2.4"]),
|
|
||||||
#Job("co-mdk101.24", ["distrib/all/build-rpm", CFGFILE, "beast", "co-mdk101","mdk101","2.4"]),
|
|
||||||
])
|
|
||||||
|
|
||||||
cyclopsTask = Task([ Job("co-mdk92.23", ["distrib/all/build-rpm", CFGFILE, "cyclops", "co-mdk92", "mdk92", "2.3"]),
|
|
||||||
Job("co-rh9.23", ["distrib/all/build-rpm", CFGFILE, "cyclops", "co-rh9", "rh9", "2.3"]),
|
|
||||||
Job("co-mdk92.24", ["distrib/all/build-rpm", CFGFILE, "cyclops", "co-mdk92", "mdk92", "2.4"]),
|
|
||||||
Job("co-rh9.24", ["distrib/all/build-rpm", CFGFILE, "cyclops", "co-rh9", "rh9", "2.4"]),
|
|
||||||
])
|
|
||||||
|
|
||||||
buildTasks = [ jaguarTask,
|
|
||||||
pantherTask,
|
|
||||||
beastTask1,
|
|
||||||
beastTask2,
|
|
||||||
cyclopsTask,
|
|
||||||
]
|
|
||||||
|
|
||||||
# Finalization. This is for things that must wait until all the
|
|
||||||
# builds are done, such as copying the installers someplace, sending
|
|
||||||
# emails, etc.
|
|
||||||
finalizationTask = Task( Job("", ["distrib/all/build-finalize", CFGFILE]) )
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
@@ -169,6 +71,8 @@ def main(args):
|
|||||||
if not os.path.isdir("wxPython") or not os.path.isdir("wx"):
|
if not os.path.isdir("wxPython") or not os.path.isdir("wx"):
|
||||||
print "Please run this script from the root wxPython directory."
|
print "Please run this script from the root wxPython directory."
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check command line flags
|
# Check command line flags
|
||||||
for flag in args:
|
for flag in args:
|
||||||
@@ -224,8 +128,59 @@ def main(args):
|
|||||||
import setup
|
import setup
|
||||||
config.VERSION = setup.VERSION
|
config.VERSION = setup.VERSION
|
||||||
|
|
||||||
# write the config file where the build scripts can find it
|
config_env = config.asDict()
|
||||||
config.write(CFGFILE)
|
config_env.update(os.environ)
|
||||||
|
|
||||||
|
print `config_env`
|
||||||
|
# Things that need to be done before any of the builds
|
||||||
|
initialTask = Task([ Job("cleanup", "distrib/all/build-setup", env=config_env),
|
||||||
|
Job("makedocs", "distrib/all/build-docs", env=config_env),
|
||||||
|
Job("maketarball", "distrib/all/build-sources", env=config_env),
|
||||||
|
])
|
||||||
|
|
||||||
|
# Build tasks. Anything that can be done in parallel (depends greatly
|
||||||
|
# on the nature of the build machines configurations...) is a separate
|
||||||
|
# task.
|
||||||
|
|
||||||
|
jaguarTask = Task( Job("whopper.23",
|
||||||
|
"distrib/all/build-osx", [config.OSX_HOST_jaguar, "jaguar", "2.3"], env=config_env) )
|
||||||
|
|
||||||
|
pantherTask = Task([ Job("bigmac.23",
|
||||||
|
"distrib/all/build-osx", [config.OSX_HOST_panther, "panther", "2.3"], env=config_env),
|
||||||
|
Job("bigmac.24",
|
||||||
|
"distrib/all/build-osx", [config.OSX_HOST_panther, "panther", "2.4"], env=config_env)
|
||||||
|
])
|
||||||
|
|
||||||
|
beastTask1 = Task([ Job("beast.23", "distrib/all/build-windows", ["2.3"], env=config_env),
|
||||||
|
Job("beast.24", "distrib/all/build-windows", ["2.4"], env=config_env),
|
||||||
|
Job("co-mdk102.24", "distrib/all/build-rpm", ["beast", "co-mdk102","mdk102","2.4"], env=config_env),
|
||||||
|
])
|
||||||
|
|
||||||
|
beastTask2 = Task([ Job("co-fc2.23", "distrib/all/build-rpm", ["beast", "co-fc2", "fc2", "2.3"], env=config_env),
|
||||||
|
Job("co-mdk101.23", "distrib/all/build-rpm", ["beast", "co-mdk101","mdk101","2.3"], env=config_env),
|
||||||
|
Job("co-fc2.24", "distrib/all/build-rpm", ["beast", "co-fc2", "fc2", "2.4"], env=config_env),
|
||||||
|
#Job("co-mdk101.24", "distrib/all/build-rpm", ["beast", "co-mdk101","mdk101","2.4"], env=config),
|
||||||
|
])
|
||||||
|
|
||||||
|
cyclopsTask = Task([ Job("co-mdk92.23", "distrib/all/build-rpm", ["cyclops", "co-mdk92", "mdk92", "2.3"], env=config_env),
|
||||||
|
Job("co-rh9.23", "distrib/all/build-rpm", ["cyclops", "co-rh9", "rh9", "2.3"], env=config_env),
|
||||||
|
Job("co-mdk92.24", "distrib/all/build-rpm", ["cyclops", "co-mdk92", "mdk92", "2.4"], env=config_env),
|
||||||
|
Job("co-rh9.24", "distrib/all/build-rpm", ["cyclops", "co-rh9", "rh9", "2.4"], env=config_env),
|
||||||
|
])
|
||||||
|
|
||||||
|
buildTasks = [ jaguarTask,
|
||||||
|
pantherTask,
|
||||||
|
beastTask1,
|
||||||
|
beastTask2,
|
||||||
|
cyclopsTask,
|
||||||
|
]
|
||||||
|
|
||||||
|
# Finalization. This is for things that must wait until all the
|
||||||
|
# builds are done, such as copying the installers someplace, sending
|
||||||
|
# emails, etc.
|
||||||
|
finalizationTask = Task( Job("", "distrib/all/build-finalize", env=config_env) )
|
||||||
|
|
||||||
|
|
||||||
print "Build getting started at: ", time.ctime()
|
print "Build getting started at: ", time.ctime()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -3,8 +3,10 @@
|
|||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
|
|
||||||
|
set
|
||||||
|
|
||||||
# read the config variables from the file given on the command line
|
# read the config variables from the file given on the command line
|
||||||
. $1
|
# . $1
|
||||||
|
|
||||||
|
|
||||||
if [ $skipdocs != yes ]; then
|
if [ $skipdocs != yes ]; then
|
||||||
|
36
wxPython/distrib/all/build-environ.cfg
Normal file
36
wxPython/distrib/all/build-environ.cfg
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
skipnewdocs="no"
|
||||||
|
|
||||||
|
# Just like the above
|
||||||
|
OSX_HOST_panther="bigmac"
|
||||||
|
OSX_HOST_jaguar="whopper"
|
||||||
|
OSX_BUILD="/BUILD"
|
||||||
|
|
||||||
|
# Alsmost the same... See below for hosts and other info
|
||||||
|
LINUX_BUILD="/tmp/BUILD"
|
||||||
|
|
||||||
|
# the local spot that we put everything when done, before possibly copying
|
||||||
|
# to remote hosts
|
||||||
|
STAGING_DIR="./BUILD"
|
||||||
|
UPLOAD_DAILY_ROOT="/home/crew/robind/public_html/wxPython/daily"
|
||||||
|
|
||||||
|
# host name of the machine to use for windows builds
|
||||||
|
WIN_HOST="beast"
|
||||||
|
|
||||||
|
# Where is the build dir from the remote machine's perspective?
|
||||||
|
WIN_BUILD="/c/BUILD"
|
||||||
|
|
||||||
|
|
||||||
|
UPLOAD_HOST="starship.python.net"
|
||||||
|
skipsource="no"
|
||||||
|
KIND="dryrun"
|
||||||
|
UPLOAD_PREVIEW_ROOT="/home/crew/robind/public_html/wxPython/rc"
|
||||||
|
skipclean="no"
|
||||||
|
|
||||||
|
skipdocs="no"
|
||||||
|
skipwin="no"
|
||||||
|
skiplinux="no"
|
||||||
|
skipupload="no"
|
||||||
|
startcohost="yes"
|
||||||
|
skiposx="no"
|
||||||
|
onlysource="no"
|
@@ -4,7 +4,7 @@
|
|||||||
set -o errexit
|
set -o errexit
|
||||||
|
|
||||||
# read the config variables from the file given on the command line
|
# read the config variables from the file given on the command line
|
||||||
. $1
|
# . $1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
set -o errexit
|
set -o errexit
|
||||||
|
|
||||||
# read the config variables from the file given on the command line
|
# read the config variables from the file given on the command line
|
||||||
. $1
|
# . $1
|
||||||
|
|
||||||
|
|
||||||
host=$2
|
host=$2
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
set -o errexit
|
set -o errexit
|
||||||
|
|
||||||
# read the config variables from the file given on the command line
|
# read the config variables from the file given on the command line
|
||||||
. $1
|
# . $1
|
||||||
|
|
||||||
coHost=$2
|
coHost=$2
|
||||||
host=$3
|
host=$3
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
set -o errexit
|
set -o errexit
|
||||||
|
|
||||||
# read the config variables from the file given on the command line
|
# read the config variables from the file given on the command line
|
||||||
. $1
|
# . $1
|
||||||
|
|
||||||
|
|
||||||
# clean out the local dist dir
|
# clean out the local dist dir
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
set -o errexit
|
set -o errexit
|
||||||
|
|
||||||
# read the config variables from the file given on the command line
|
# read the config variables from the file given on the command line
|
||||||
. $1
|
# . $1
|
||||||
|
|
||||||
if [ $skipsource != yes -o $onlysource = yes ]; then
|
if [ $skipsource != yes -o $onlysource = yes ]; then
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
set -o errexit
|
set -o errexit
|
||||||
|
|
||||||
# read the config variables from the file given on the command line
|
# read the config variables from the file given on the command line
|
||||||
. $1
|
# . $1
|
||||||
|
|
||||||
PYVER=$2
|
PYVER=$2
|
||||||
|
|
||||||
|
@@ -24,6 +24,29 @@ __all__ = ["Job", "Task", "TaskRunner"]
|
|||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# For environment settings
|
||||||
|
class Config:
|
||||||
|
def asDict(self):
|
||||||
|
return self.__dict__.copy()
|
||||||
|
|
||||||
|
def write(self, filename="config", outfile=None):
|
||||||
|
if outfile is None:
|
||||||
|
f = file(filename, "w")
|
||||||
|
else:
|
||||||
|
f = outfile
|
||||||
|
for k, v in self.__dict__.items():
|
||||||
|
f.write('%s="%s"\n' % (k, v))
|
||||||
|
|
||||||
|
def read(self, filename="config"):
|
||||||
|
myfile = open(filename, "r")
|
||||||
|
for line in myfile.readlines():
|
||||||
|
line = line.strip()
|
||||||
|
if len(line) > 0 and line[0] == "#":
|
||||||
|
continue # it's a comment, move on
|
||||||
|
data = line.split("=")
|
||||||
|
if len(data) == 2:
|
||||||
|
self.__dict__[data[0]] = data[1]
|
||||||
|
myfile.close()
|
||||||
|
|
||||||
class Job(object):
|
class Job(object):
|
||||||
"""
|
"""
|
||||||
@@ -35,17 +58,21 @@ class Job(object):
|
|||||||
|
|
||||||
LOGBASE="."
|
LOGBASE="."
|
||||||
|
|
||||||
def __init__(self, label, args):
|
def __init__(self, label, command, args=[], env=os.environ):
|
||||||
self.label = label
|
self.label = label
|
||||||
|
self.command = command
|
||||||
self.args = args
|
self.args = args
|
||||||
|
self.env = env
|
||||||
self.proc = None
|
self.proc = None
|
||||||
if self.label:
|
if self.label:
|
||||||
|
if not os.path.exists(self.LOGBASE):
|
||||||
|
os.mkdirs(self.LOGBASE)
|
||||||
self.log = file("%s/%s.log" % (self.LOGBASE, label), "w", 0)
|
self.log = file("%s/%s.log" % (self.LOGBASE, label), "w", 0)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.proc = Popen(self.args, # the command and args to execute
|
self.proc = Popen([self.command] + self.args, # the command and args to execute
|
||||||
stdout=PIPE, stderr=STDOUT,
|
stdout=PIPE, stderr=STDOUT, env=self.env,
|
||||||
bufsize=0, # line-buffered
|
bufsize=0 # line-buffered
|
||||||
)
|
)
|
||||||
# put the file in non-blocking mode
|
# put the file in non-blocking mode
|
||||||
#flags = fcntl.fcntl (self.proc.stdout, fcntl.F_GETFL, 0)
|
#flags = fcntl.fcntl (self.proc.stdout, fcntl.F_GETFL, 0)
|
||||||
|
Reference in New Issue
Block a user