rota = """kps.rotations.register("%s","%s",\n{\n""" % (self.kps_class.upper(),self.kps_spec.upper()) for r in simc.convert_to_action_list(): rota += "%s\n" % r rota += """}\n,"%s")""" % self.kps_title return header + "\n" + rota + "\n" if __name__ == "__main__": parser = argparse.ArgumentParser(description='SimC 2 KPS Rotation Converter') parser.add_argument('-p','--simc-profile', dest="simc", help='SimC Profile', required=True) parser.add_argument('-c','--kps-class', dest="kps_class", help='KPS Class', required=True, choices=SUPPORTED_SPECS.keys()) parser.add_argument('-s','--kps-spec', dest="kps_spec", help='KPS Spec', required=True) parser.add_argument('-t','--title', help='KPS Rotation Title', default=None) group = parser.add_mutually_exclusive_group() group.add_argument('-o','--output', help='Output file (omit to print to stdout)', default=None) group.add_argument('-a','--append', help='Append file (omit to print to stdout)', default=None) args = setup_logging_and_get_args(parser) meta = parse_rotation_meta(args.kps_class, args.kps_spec) if "generated_from" in meta.keys(): simc = SimCraftProfile(args.simc, args.kps_class, args.kps_spec, args.title) if args.output: open(args.output,"w").write(str(simc)) elif args.append: simc.show_header = False open(args.append,"a").write(str(simc)) else: print simc else: LOG.info("Skipping %s:%s - Manual rotation" % (args.kps_class, args.kps_spec))
header += "local env = kps.env.%s\n\n" % self.kps_class else: header = "\n--GENERATED FROM SIMCRAFT PROFILE '%s'" % os.path.basename(self.filename) rota = """kps.rotations.register("%s","%s",\n{\n""" % (self.kps_class.upper(), self.kps_spec.upper()) for r in simc.convert_to_action_list(): rota += "%s\n" % r rota += """}\n,"%s")""" % self.kps_title return header + "\n" + rota + "\n" if __name__ == "__main__": parser = argparse.ArgumentParser(description="SimC 2 KPS Rotation Converter") parser.add_argument("-p", "--simc-profile", dest="simc", help="SimC Profile", required=True) parser.add_argument( "-c", "--kps-class", dest="kps_class", help="KPS Class", required=True, choices=SUPPORTED_SPECS.keys() ) parser.add_argument("-s", "--kps-spec", dest="kps_spec", help="KPS Spec", required=True) parser.add_argument("-t", "--title", help="KPS Rotation Title", default=None) group = parser.add_mutually_exclusive_group() group.add_argument("-o", "--output", help="Output file (omit to print to stdout)", default=None) group.add_argument("-a", "--append", help="Append file (omit to print to stdout)", default=None) args = setup_logging_and_get_args(parser) simc = SimCraftProfile(args.simc, args.kps_class, args.kps_spec, args.title) if args.output: open(args.output, "w").write(str(simc)) elif args.append: simc.show_header = False open(args.append, "a").write(str(simc)) else: print simc