]> git.saurik.com Git - wxWidgets.git/commitdiff
Adding code to load Config objects from a file, and move to modifying environment...
authorKevin Ollivier <kevino@theolliviers.com>
Mon, 27 Feb 2006 03:25:48 +0000 (03:25 +0000)
committerKevin Ollivier <kevino@theolliviers.com>
Mon, 27 Feb 2006 03:25:48 +0000 (03:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37744 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/distrib/all/build-all
wxPython/distrib/all/build-docs
wxPython/distrib/all/build-environ.cfg [new file with mode: 0644]
wxPython/distrib/all/build-finalize
wxPython/distrib/all/build-osx
wxPython/distrib/all/build-rpm
wxPython/distrib/all/build-setup
wxPython/distrib/all/build-sources
wxPython/distrib/all/build-windows
wxPython/distrib/all/taskrunner.py

index 1f3a9e764b8c786eb63f2f978a602eb14d10e7e9..68b6e82f8e9c8ddf4902042b578e86188374474e 100755 (executable)
 import sys
 import os
 import time
-from taskrunner import Job, Task, TaskRunner
+from taskrunner import Job, Task, TaskRunner, Config
 
 #----------------------------------------------------------------------
 # Configuration items
 
-class Config:
-    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))
-
+CFGFILE = "./distrib/all/build-environ.cfg"
 config = Config()
-
-# 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"
+config.read(CFGFILE)
 
 #----------------------------------------------------------------------
 # Define all the build tasks
@@ -81,58 +35,6 @@ config.startcohost = "yes"
 class Job(Job):
     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():
@@ -169,6 +71,8 @@ def main(args):
     if not os.path.isdir("wxPython") or not os.path.isdir("wx"):
         print "Please run this script from the root wxPython directory."
         sys.exit(1)
+        
+    
 
     # Check command line flags
     for flag in args:
@@ -224,8 +128,59 @@ def main(args):
     import setup
     config.VERSION = setup.VERSION
 
-    # write the config file where the build scripts can find it
-    config.write(CFGFILE)
+    config_env = config.asDict()
+    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()
 
 
index 24b72f3931f9ef675371be43ec783b456d660fa1..3c982706d8d9e5627653f75a018376bbdf43938b 100755 (executable)
@@ -3,8 +3,10 @@
 
 set -o errexit
 
+set
+
 # read the config variables from the file given on the command line
-. $1
+. $1
 
 
 if [ $skipdocs != yes ]; then 
diff --git a/wxPython/distrib/all/build-environ.cfg b/wxPython/distrib/all/build-environ.cfg
new file mode 100644 (file)
index 0000000..c8e4c70
--- /dev/null
@@ -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"
index 84d705527ca2a1bcc416005147705d7a47ac7745..4ce39615107f5f9379205ede49d75a0a44026164 100755 (executable)
@@ -4,7 +4,7 @@
 set -o errexit
 
 # read the config variables from the file given on the command line
-. $1
+. $1
 
 
 
index c7c6fa2c9188fb44baae45837cc21e1febe5f0dc..40bba17664bfabe7b1cddcd2402da876aa8c6efd 100755 (executable)
@@ -4,7 +4,7 @@
 set -o errexit
 
 # read the config variables from the file given on the command line
-. $1
+. $1
 
 
 host=$2
index 4c371a8682e4ea1da79b490f4449bb7c1811fc48..d2932e2479ef4c2dbd0b5fea116425e45529ee07 100755 (executable)
@@ -4,7 +4,7 @@
 set -o errexit
 
 # read the config variables from the file given on the command line
-. $1
+. $1
 
 coHost=$2
 host=$3
index f8134cd1515366a6cab32b1221e0d8421b66fa21..051a5be90052767c5e45b2f0d376ad013c8ac54f 100755 (executable)
@@ -4,7 +4,7 @@
 set -o errexit
 
 # read the config variables from the file given on the command line
-. $1
+. $1
 
 
 # clean out the local dist dir
index a85d3bbef28f87ee483950de24a0f88f03bc1a9e..3e7f9bdcdd97700e2861a73f98ee6f729e475166 100755 (executable)
@@ -4,7 +4,7 @@
 set -o errexit
 
 # read the config variables from the file given on the command line
-. $1
+. $1
 
 if [ $skipsource != yes -o $onlysource = yes ]; then
 
index 95a946b1a36a0a4bfd32d2900dfa648a4c8d3861..f2723aa57f3dbfe34edfa622548c0c7368726aa7 100755 (executable)
@@ -4,7 +4,7 @@
 set -o errexit
 
 # read the config variables from the file given on the command line
-. $1
+. $1
 
 PYVER=$2
 
index c6c10828924b0559a890655a7106f2e4913dd871..2c2c47aacf1f1aa39b13dd22989d71ce78d6b3df 100644 (file)
@@ -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):
     """
@@ -35,17 +58,21 @@ class Job(object):
 
     LOGBASE="."
     
-    def __init__(self, label, args):
+    def __init__(self, label, command, args=[], env=os.environ):
         self.label = label
+        self.command = command
         self.args = args
+        self.env = env
         self.proc = None
         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)
 
     def start(self):
-        self.proc = Popen(self.args, # the command and args to execute
-                          stdout=PIPE, stderr=STDOUT,
-                          bufsize=0, # line-buffered
+        self.proc = Popen([self.command] + self.args, # the command and args to execute
+                          stdout=PIPE, stderr=STDOUT, env=self.env,
+                          bufsize=0 # line-buffered
                           )
         # put the file in non-blocking mode
         #flags = fcntl.fcntl (self.proc.stdout, fcntl.F_GETFL, 0)