# analyse the given arguments args = get_args() # expand the meta ini files into a list of configurations configurations = expand_meta_ini(args["ini"]) # initialize a data structure to pass the list of generated ini files to CMake metaini = {} metaini["names"] = [] # TODO this should have underscores! metaini["labels"] = {} # extract the static information from the meta ini file static_info = extract_static_info(args["ini"], section=args['section']) # write the configurations to the file specified in the name key. for c in configurations: # Discard label groups from the data if "__LABELS" in c: c["__LABELS"] = list(c["__LABELS"].values()) metaini["labels"][c["__name"]] = c["__LABELS"] write_configuration_to_ini(c, metaini, static_info, args, section=args['section']) if args["cmake"]: from dune.testtools.cmakeoutput import printForCMake printForCMake(metaini)
# analyse the given arguments args = get_args() # expand the meta ini files into a list of configurations configurations = expand_meta_ini(args["ini"]) # initialize a data structure to pass the list of generated ini files to CMake metaini = {} metaini["names"] = [] # TODO this should have underscores! metaini["labels"] = {} # extract the static information from the meta ini file static_info = extract_static_info(args["ini"], section=args['section']) # write the configurations to the file specified in the name key. for c in configurations: # Discard label groups from the data if "__LABELS" in c: c["__LABELS"] = list(c["__LABELS"].values()) metaini["labels"][c["__name"]] = c["__LABELS"] write_configuration_to_ini(c, metaini, static_info, args, section=args['section']) if args["cmake"]: from dune.testtools.cmakeoutput import printForCMake printForCMake(metaini, args['file'])
""" if __name__ == "__main__": import argparse from dune.testtools.static_metaini import extract_static_info from dune.testtools.cmakeoutput import printForCMake def get_args(): parser = argparse.ArgumentParser() parser.add_argument('-i', '--ini', help='The meta-inifile to expand', required=True) parser.add_argument( '-s', '--section', default="__static", help= 'The section to treat as the static section (defaults to __static)' ) return vars(parser.parse_args()) # analyse the given arguments args = get_args() # call the macro static = extract_static_info(args["ini"], args['section'], add_guards=True) # print to CMake printForCMake(static)
from dune.testtools.cmakeoutput import printForCMake def get_args(): parser = argparse.ArgumentParser() parser.add_argument('-i', '--ini', help='The meta-inifile to expand', required=True) parser.add_argument( '-s', '--section', default="__static", help= 'The section to treat as the static section (defaults to __static)' ) parser.add_argument( '-f', '--file', default=None, help='The filename to write the result into (stdout if omitted)') return vars(parser.parse_args()) # analyse the given arguments args = get_args() # call the macro static = extract_static_info(args["ini"], args['section'], add_guards=True) # print to CMake printForCMake(static, args['file'])
from dune.testtools.cmakeoutput import printForCMake import sys # define a rather complex data structure to pass to CMake d = {} # simple keys with different combinations of key and value types d[3] = "5" d[2] = 17 d[8] = [4, "something"] d["mykey"] = ["bla", "blubb"] d["nested"] = {} d["nested"]["bla"] = "val" d["nested"][5] = {} d["nested"][5]["deeper"] = "wow!" """ d should produce the following variables in CMake: TESTPREFIX_3 TESTPREFIX_2 TESTPREFIX_8 TESTPREFIX_mykey TESTPREFIX_nested_bla TESTPREFIX_nested_5_deeper """ printForCMake(d, sys.argv[1])