LOG = None
VERBOSE = False
+REQUIRE_ALL = False
# standard line print
def lprint(x):
sys.stdout.write(x)
sys.stdout.flush()
LOG.write(x)
-
+
class IniParser:
def __init__(self, file):
self.__d = {}
self.buildorder = []
self.updatemodules(self.keys("modules"))
- self.selectlibs = {}
+ self.selectlibs = {}
for k, v in self.setdefault("selectlibs", {}).items():
self.selectlibs[k] = v.split()
if c2.has_key("options"):
self.options.update(c2["options"])
+ if c2.has_key("osvars"):
+ for k, v in c2.keys("osvars"):
+ self.osflags.setdefault(k, []).append(v)
+
def librarycheck(libraries, includes, libs):
def findlibrarypaths(library, x, includes, libs):
if x["alwayspresent"]:
for x in haystack:
p = os.path.join(x, needle)
if os.path.exists(p):
+ vprint(" found: %s" % p)
return x
found = []
lprint("configure: selected: %s" % " ".join(building))
if len(notfound) > 0:
lprint("configure: couldn't find: %s" % " ".join(notfound))
+ check_require_all()
if len(cantbuild) > 0:
lprint("configure: can't select: %s" % " ".join(cantbuild))
+ check_require_all()
+
+def check_require_all():
+ if REQUIRE_ALL:
+ lprint("configure: require-all selected, so failing")
+ sys.exit(1)
+
+validopts = {}
def usage():
print
print " Additional options are:"
for k, v in validopts.items():
print " --with-%s=[%s]" % (v[0], "|".join(v[1]))
-
- print " -L [additional lib dir]"
+ print " -L [additional lib dir]"
print " -I [additional include dir]"
print " -m [additional module]"
+ print " -R: require everything"
print " -v: verbose"
-def main(workspacesfile):
- global LOG, VERBOSE
+def main():
+ global LOG, VERBOSE, REQUIRE_ALL
- workspacesconfig = IniParser(open(workspacesfile, "r"))
+ files, workspaces = [], []
+ for root, _, file_list in os.walk("."):
+ if "configure.ini" not in file_list:
+ continue
- files = []
- workspaces = []
+ print "found workspace: %s" % root
+ workspaces.append(root)
- for workspace in ["."] + workspacesconfig["workspaces"].keys():
- path = workspace + "/configure.ini"
- if os.path.exists(path):
- print "found workspace: %s" % workspace
- workspaces.append(workspace)
- files.append( (workspace, open(path, "r")) )
+ path = os.path.join(root, "configure.ini")
+ files.append( (root, open(path, "r")) )
- local_path = workspace + "/configure.ini.local"
- if os.path.exists(local_path):
- files.append( (workspace, open(local_path, "r")) )
+ local_path = os.path.join(root, "configure.ini.local")
+ if os.path.exists(local_path):
+ files.append( (root, open(local_path, "r")) )
config = MultiConfigureIniParser(files)
mopts = []
- validopts = {}
+
for k, v in config.selectlibs.items():
mopts.append("with-%s=" % k)
validopts["--with-%s" % k] = (k, v)
try:
- opts, args = getopt.getopt(sys.argv[1:], "hvcI:L:m:", mopts)
+ opts, args = getopt.getopt(sys.argv[1:], "hvcI:L:m:R", mopts)
except getopt.GetoptError, err:
print str(err)
usage()
return
elif o == "-v":
VERBOSE = True
+ elif o == "-R":
+ REQUIRE_ALL = True
elif o == "-L":
libs.append(a)
elif o == "-I":
configure(config, overrides, workspaces)
if __name__ == "__main__":
- main("workspaces.ini")
+ main()