return self.name
- def clean(self, dir=None, projectFile=None, options=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
"""
if self.isAvailable():
- if options:
- optionList = list(options)
- else:
- optionList = []
-
- optionList.insert(0, self.getProgramPath())
- optionList.append("clean")
+ args = [self.getProgramPath()]
+ args.extend(self.getProjectFileArg(projectFile))
+ args.append("clean")
+ args.extend(options)
- result = runInDir(optionList, dir)
+ result = runInDir(args, dir)
return result
return False
- def configure(self, options=None):
+ def configure(self, dir=None, options=[]):
# 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 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
- def install(self, dir=None, options=None):
+ def install(self, dir=None, projectFile=None, options=[]):
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
def __init__(self, formatName="autoconf"):
GNUMakeBuilder.__init__(self, formatName=formatName)
- def configure(self, dir=None, options=None):
- #olddir = os.getcwd()
- #os.chdir(dir)
-
- configdir = dir
+ def configure(self, dir=None, options=[]):
if not dir:
- configdir = os.getcwd()
+ dir = os.getcwd()
+ configdir = dir
configure_cmd = ""
while os.path.exists(configdir):
sys.stderr.write("Could not find configure script at %r. Have you run autoconf?\n" % dir)
return 1
+ olddir = os.getcwd()
+ os.chdir(configdir)
+
optionsStr = " ".join(options) if options else ""
- command = "%s %s" % (configure_cmd, optionsStr)
+ command = "./configure %s" % optionsStr
print(command)
result = os.system(command)
- #os.chdir(olddir)
+ os.chdir(olddir)
return result
return True
return False
+ def getProjectFileArg(self, projectFile = None):
+ result = []
+ if projectFile:
+ result.extend(['-f', projectFile])
+
+ return result
+
class MSVCProjectBuilder(Builder):
def __init__(self):