def composite_options(platformopts): options = {} p = get_platforms() for platform,opts in platformopts.iteritems(): if platform != "none" and (not platform in p): continue for k,v in opts.iteritems(): if k in options: # append to the already-existing option options[k].extend(v) continue options[k] = v return options
def main(): global tasks, START_POINT, FILE, COMPILER, REBUILD opt = optparse.OptionParser() opt.add_option("-f", "--in", dest="file", help="input .bmk file", metavar="FILE", default=FILE) opt.add_option("-s", "--start", dest="startpoint", help="which task to start with", metavar="STARTPOINT", default=START_POINT) opt.add_option("-c", "--compiler", dest="compiler", help="which compiler to use", metavar="COMPILER", default=COMPILER) opt.add_option("-r", "--rebuild", dest="rebuild", help="rebuild project (skip checking of file dates)", action="store_true", metavar="REBUILD", default=REBUILD) opt.add_option("", "--debug", help="turn debugging on", action="store_true", default=False, metavar="DEBUG") options, args = opt.parse_args() START_POINT = options.startpoint FILE = options.file COMPILER = options.compiler REBUILD = options.rebuild print "platform:", get_platforms() try: f = open(FILE, "r") text = f.read() f.close() except: print "error opening file %s" % FILE sys.exit(1) p = parse.bmk_parse(text) tasks = p["tasks"] # composite them all for k,platformopts in tasks.iteritems(): tasks[k] = composite_options(platformopts) print "building %s" % START_POINT # check for (start) if START_POINT in tasks: buildtask(START_POINT) else: print "error: no task '%s'" % START_POINT sys.exit(2)
#except: # return "" def find_python(): r = [] for currentversion in "2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5".split(): currentversion_nodots = currentversion.replace(".", "") names = ["python%s" % currentversion_nodots, "python%s" % currentversion] paths = [regread("SOFTWARE\\Python\\PythonCore\\%s" % currentversion, "InstallPath") + "/libs"] r.append((find_library(names, paths), [])) return r packages = {"python": find_python} platforms = util.get_platforms() def find_library(names, paths): return paths def find_package(lib): #try: return packages[lib]() #except Exception, e: # print e # return None #print "py:", find_package("python")