]> git.saurik.com Git - wxWidgets.git/blobdiff - build/tools/builder.py
Added setters for table row and column count
[wxWidgets.git] / build / tools / builder.py
index 7c067ae8a8f948155aeabae56790972cbee6dfef..4087cf53b376a16e0c7f94951d6e54550c0e4f8a 100755 (executable)
@@ -1,5 +1,4 @@
 import os
 import os
-import string
 import subprocess
 import sys
 import time
 import subprocess
 import sys
 import time
@@ -18,7 +17,7 @@ def runInDir(command, dir=None, verbose=True):
 
     commandStr = " ".join(command)
     if verbose:
 
     commandStr = " ".join(command)
     if verbose:
-        print commandStr
+        print(commandStr)
     result = os.system(commandStr)
 
     if dir:
     result = os.system(commandStr)
 
     if dir:
@@ -89,46 +88,50 @@ class Builder:
 
         return self.name
 
 
         return self.name
 
-    def clean(self, dir=None, projectFile=None):
+    def getProjectFileArg(self, projectFile = None):
+        result = []
+        if projectFile:
+            result.append(projectFile)
+        return result
+    
+    def clean(self, dir=None, projectFile=None, options=[]):
         """
         dir = the directory containing the project file
         projectFile = Some formats need to explicitly specify the project file's name
         """
         """
         dir = the directory containing the project file
         projectFile = Some formats need to explicitly specify the project file's name
         """
-        
-        args = [self.getProgramPath(), "clean"]
-        if dir:
-            args.append(dir)
         if self.isAvailable():
         if self.isAvailable():
-            result = runInDir(args)
+            args = [self.getProgramPath()]
+            args.extend(self.getProjectFileArg(projectFile))
+            args.append("clean")
+            args.extend(options)
+        
+            result = runInDir(args, dir)
             return result
 
         return False
 
             return result
 
         return False
 
-    def configure(self, options=None):
+    def configure(self, dir=None, options=[]):
         # if we don't have configure, just report success
         # if we don't have configure, just report success
-        return True
+        return 0
 
 
-    def build(self, dir=None, projectFile=None, targets=None, options=None):
+    def build(self, dir=None, projectFile=None, targets=None, options=[]):
         if self.isAvailable():
         if self.isAvailable():
-            if options:
-                optionList = list(options)
-            else:
-                optionList = []
-
-            optionList.insert(0, self.getProgramPath())
+            args = [self.getProgramPath()]
+            args.extend(self.getProjectFileArg(projectFile))
+            args.extend(options)
 
 
-            result = runInDir(optionList, dir)
+            result = runInDir(args, dir)
 
             return result
 
         return 1
 
 
             return result
 
         return 1
 
-    def install(self, dir=None, options=None):
+    def install(self, dir=None, projectFile=None, options=[]):
         if self.isAvailable():
         if self.isAvailable():
-
-            args = ["make", "install"]
-            if options:
-                args.extend(options)
+            args = [self.getProgramPath()]
+            args.extend(self.getProjectFileArg(projectFile))
+            args.append("install")
+            args.extend(options)
             result = runInDir(args, dir)
             return result
 
             result = runInDir(args, dir)
             return result
 
@@ -141,8 +144,8 @@ class GNUMakeBuilder(Builder):
         Builder.__init__(self, commandName=commandName, formatName=formatName)
 
 
         Builder.__init__(self, commandName=commandName, formatName=formatName)
 
 
-class XCodeBuilder(Builder):
-    def __init__(self, commandName="xcodebuild", formatName="XCode"):
+class XcodeBuilder(Builder):
+    def __init__(self, commandName="xcodebuild", formatName="Xcode"):
         Builder.__init__(self, commandName=commandName, formatName=formatName)
 
 
         Builder.__init__(self, commandName=commandName, formatName=formatName)
 
 
@@ -175,17 +178,17 @@ class AutoconfBuilder(GNUMakeBuilder):
             sys.stderr.write("Could not find configure script at %r. Have you run autoconf?\n" % dir)
             return 1
 
             sys.stderr.write("Could not find configure script at %r. Have you run autoconf?\n" % dir)
             return 1
 
-        optionsStr = string.join(options, " ") if options else ""
+        optionsStr = " ".join(options) if options else ""
         command = "%s %s" % (configure_cmd, optionsStr)
         command = "%s %s" % (configure_cmd, optionsStr)
-        print command
+        print(command)
         result = os.system(command)
         #os.chdir(olddir)
         return result
 
 
 class MSVCBuilder(Builder):
         result = os.system(command)
         #os.chdir(olddir)
         return result
 
 
 class MSVCBuilder(Builder):
-    def __init__(self):
-        Builder.__init__(self, commandName="nmake.exe", formatName="msvc")
+    def __init__(self, commandName="nmake.exe"):
+        Builder.__init__(self, commandName=commandName, formatName="msvc")
 
     def isAvailable(self):
         PATH = os.environ['PATH'].split(os.path.pathsep)
 
     def isAvailable(self):
         PATH = os.environ['PATH'].split(os.path.pathsep)
@@ -194,13 +197,20 @@ class MSVCBuilder(Builder):
                 return True
         return False
 
                 return True
         return False
 
+    def getProjectFileArg(self, projectFile = None):
+        result = []
+        if projectFile:
+            result.extend(['-f', projectFile])
+            
+        return result
+
         
 class MSVCProjectBuilder(Builder):
     def __init__(self):
         Builder.__init__(self, commandName="VCExpress.exe", formatName="msvcProject")
         for key in ["VS90COMNTOOLS", "VC80COMNTOOLS", "VC71COMNTOOLS"]:
             if os.environ.has_key(key):
         
 class MSVCProjectBuilder(Builder):
     def __init__(self):
         Builder.__init__(self, commandName="VCExpress.exe", formatName="msvcProject")
         for key in ["VS90COMNTOOLS", "VC80COMNTOOLS", "VC71COMNTOOLS"]:
             if os.environ.has_key(key):
-                self.prgoramDir = os.path.join(os.environ[key], "..", "IDE")
+                self.programDir = os.path.join(os.environ[key], "..", "IDE")
 
         if self.programDir == None:
             for version in ["9.0", "8", ".NET 2003"]:
 
         if self.programDir == None:
             for version in ["9.0", "8", ".NET 2003"]:
@@ -223,7 +233,7 @@ class MSVCProjectBuilder(Builder):
 
         return False
 
 
         return False
 
-builders = [GNUMakeBuilder, XCodeBuilder, AutoconfBuilder, MSVCBuilder, MSVCProjectBuilder]
+builders = [GNUMakeBuilder, XcodeBuilder, AutoconfBuilder, MSVCBuilder, MSVCProjectBuilder]
 
 def getAvailableBuilders():
     availableBuilders = {}
 
 def getAvailableBuilders():
     availableBuilders = {}