Changes needed to help builder.py be more generic and working well with other modules
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73855 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -88,50 +88,50 @@ class Builder:
|
|||||||
|
|
||||||
return self.name
|
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
|
dir = the directory containing the project file
|
||||||
projectFile = Some formats need to explicitly specify the project file's name
|
projectFile = Some formats need to explicitly specify the project file's name
|
||||||
"""
|
"""
|
||||||
if self.isAvailable():
|
if self.isAvailable():
|
||||||
if options:
|
args = [self.getProgramPath()]
|
||||||
optionList = list(options)
|
args.extend(self.getProjectFileArg(projectFile))
|
||||||
else:
|
args.append("clean")
|
||||||
optionList = []
|
args.extend(options)
|
||||||
|
|
||||||
optionList.insert(0, self.getProgramPath())
|
|
||||||
optionList.append("clean")
|
|
||||||
|
|
||||||
result = runInDir(optionList, dir)
|
result = runInDir(args, dir)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
return False
|
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:
|
args = [self.getProgramPath()]
|
||||||
optionList = list(options)
|
args.extend(self.getProjectFileArg(projectFile))
|
||||||
else:
|
args.extend(options)
|
||||||
optionList = []
|
|
||||||
|
|
||||||
optionList.insert(0, self.getProgramPath())
|
result = runInDir(args, dir)
|
||||||
|
|
||||||
result = runInDir(optionList, dir)
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def install(self, dir=None, options=None):
|
def install(self, dir=None, projectFile=None, options=[]):
|
||||||
if self.isAvailable():
|
if self.isAvailable():
|
||||||
|
args = [self.getProgramPath()]
|
||||||
args = ["make", "install"]
|
args.extend(self.getProjectFileArg(projectFile))
|
||||||
if options:
|
args.append("install")
|
||||||
args.extend(options)
|
args.extend(options)
|
||||||
result = runInDir(args, dir)
|
result = runInDir(args, dir)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@@ -153,13 +153,10 @@ class AutoconfBuilder(GNUMakeBuilder):
|
|||||||
def __init__(self, formatName="autoconf"):
|
def __init__(self, formatName="autoconf"):
|
||||||
GNUMakeBuilder.__init__(self, formatName=formatName)
|
GNUMakeBuilder.__init__(self, formatName=formatName)
|
||||||
|
|
||||||
def configure(self, dir=None, options=None):
|
def configure(self, dir=None, options=[]):
|
||||||
#olddir = os.getcwd()
|
|
||||||
#os.chdir(dir)
|
|
||||||
|
|
||||||
configdir = dir
|
|
||||||
if not dir:
|
if not dir:
|
||||||
configdir = os.getcwd()
|
dir = os.getcwd()
|
||||||
|
configdir = dir
|
||||||
|
|
||||||
configure_cmd = ""
|
configure_cmd = ""
|
||||||
while os.path.exists(configdir):
|
while os.path.exists(configdir):
|
||||||
@@ -178,11 +175,14 @@ class AutoconfBuilder(GNUMakeBuilder):
|
|||||||
sys.stderr.write("Could not find configure script at %r. Have you run autoconf?\n" % dir)
|
sys.stderr.write("Could not find configure script at %r. Have you run autoconf?\n" % dir)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
olddir = os.getcwd()
|
||||||
|
os.chdir(configdir)
|
||||||
|
|
||||||
optionsStr = " ".join(options) if options else ""
|
optionsStr = " ".join(options) if options else ""
|
||||||
command = "%s %s" % (configure_cmd, optionsStr)
|
command = "./configure %s" % optionsStr
|
||||||
print(command)
|
print(command)
|
||||||
result = os.system(command)
|
result = os.system(command)
|
||||||
#os.chdir(olddir)
|
os.chdir(olddir)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@@ -197,6 +197,13 @@ class MSVCBuilder(Builder):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def getProjectFileArg(self, projectFile = None):
|
||||||
|
result = []
|
||||||
|
if projectFile:
|
||||||
|
result.extend(['-f', projectFile])
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
class MSVCProjectBuilder(Builder):
|
class MSVCProjectBuilder(Builder):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
Reference in New Issue
Block a user