from MAT.Operation import OptionParser, OptionGroup parser = OptionParser(usage = """Usage: %prog [options] mat_1_3_root task_xml [outdir] mat_1_3_root: a 1.3 final MAT root directory, typically src/MAT in the 1.3 distribution task_xml: the task.xml file to update. The original file will be written to task.xml.1_3, and the new file, no matter what this name is, is task.xml. This way, you can repeatedly update the 1.3 task.xml file if you need to outdir: the directory to save the task.xml files to. Optional. By default, this will be the same directory you started with.""") parser.add_option("--print_to_stdout", action = "store_true", help = "if present, print to stdout instead of task.xml, and don't copy the original") parser.add_option("--cheat_on_1_3_requirement", action = "store_true", help = "don't require that the mat_1_3_root actually be 1.3, but permit early versions of 2.0") options, args = parser.parse_args() if len(args) not in (2, 3): parser.print_help() sys.exit(1) [MAT_1_3_ROOT, TASK_XML] = args[:2] MAT_1_3_ROOT = os.path.realpath(os.path.abspath(MAT_1_3_ROOT)) PRINT_TO_STDOUT = options.print_to_stdout TASK_XML = os.path.realpath(os.path.abspath(TASK_XML)) if len(args) == 3: OUTDIR = args[2] else: OUTDIR = os.path.dirname(TASK_XML) vFile = os.path.join(MAT_1_3_ROOT, "etc", "VERSION")
ALL_OPERATIONS = [] _allOperations(WorkspaceGeneralOperation, ALL_OPERATIONS) parser = OptionParser(usage = """Usage: %prog [options] <dir> create ... """ + "\n".join([" %prog [options] <dir> " + op + " ..." for op in ALL_OPERATIONS]) + \ """ Provide the directory and operation followed by --help for more detailed help.""") parser.add_option("--other_app_dir", action = "append", dest="other_dirs", help="additional directory to load a task from. Optional.") MAT.ExecutionContext.addOptions(parser) parser.disable_interspersed_args() coreOptions, args = parser.parse_args() if len(args) < 1: parser.print_help() sys.exit(1) # At this point, we can load the plugins. otherDirs = coreOptions.other_dirs or [] MAT.ExecutionContext.extractOptions(coreOptions) from MAT.ExecutionContext import _DEBUG try: PLUGIN_DIR = MAT.PluginMgr.LoadPlugins(*otherDirs)