def get_default_options_parser(add_clean=True, add_options=True): parser = ArgumentParser() targetnames = TARGET_NAMES targetnames.sort() toolchainlist = list(TOOLCHAINS) toolchainlist.sort() parser.add_argument( "-m", "--mcu", help="build for the given MCU (%s)" % ', '.join(targetnames), metavar="MCU", type=argparse_many(argparse_force_uppercase_type(targetnames, "MCU"))) parser.add_argument( "-t", "--tool", help="build using the given TOOLCHAIN (%s)" % ', '.join(toolchainlist), metavar="TOOLCHAIN", type=argparse_many( argparse_force_uppercase_type(toolchainlist, "toolchain"))) parser.add_argument("--color", help="print Warnings, and Errors in color", action="store_true", default=False) if add_clean: parser.add_argument("-c", "--clean", action="store_true", default=False, help="clean the build directory") if add_options: parser.add_argument( "-o", "--options", action="append", help= 'Add a build argument ("save-asm": save the asm generated by the compiler, "debug-info": generate debugging information, "analyze": run Goanna static code analyzer")', type=argparse_lowercase_hyphen_type( ['save-asm', 'debug-info', 'analyze'], "build option")) return parser
def get_default_options_parser(add_clean=True, add_options=True): parser = ArgumentParser() targetnames = TARGET_NAMES targetnames.sort() toolchainlist = list(TOOLCHAINS) toolchainlist.sort() parser.add_argument( "-m", "--mcu", help="build for the given MCU (%s)" % ", ".join(targetnames), metavar="MCU", type=argparse_many(argparse_force_uppercase_type(targetnames, "MCU")), ) parser.add_argument( "-t", "--tool", help="build using the given TOOLCHAIN (%s)" % ", ".join(toolchainlist), metavar="TOOLCHAIN", type=argparse_many(argparse_force_uppercase_type(toolchainlist, "toolchain")), ) parser.add_argument("--color", help="print Warnings, and Errors in color", action="store_true", default=False) if add_clean: parser.add_argument("-c", "--clean", action="store_true", default=False, help="clean the build directory") if add_options: parser.add_argument( "-o", "--options", action="append", help='Add a build argument ("save-asm": save the asm generated by the compiler, "debug-info": generate debugging information, "analyze": run Goanna static code analyzer")', type=argparse_lowercase_hyphen_type(["save-asm", "debug-info", "analyze"], "build option"), ) return parser
if __name__ == '__main__': # Parse Options parser = ArgumentParser() targetnames = TARGET_NAMES targetnames.sort() toolchainlist = EXPORTERS.keys() toolchainlist.sort() parser.add_argument("-m", "--mcu", metavar="MCU", default='LPC1768', type=argparse_many( argparse_force_uppercase_type(targetnames, "MCU")), help="generate project for the given MCU (%s)" % ', '.join(targetnames)) parser.add_argument("-i", dest="ide", default='uvision', type=argparse_force_lowercase_type( toolchainlist, "toolchain"), help="The target IDE: %s" % str(toolchainlist)) parser.add_argument("-c", "--clean", action="store_true", default=False, help="clean the export directory")
if __name__ == '__main__': # Parse Options parser = ArgumentParser() targetnames = TARGET_NAMES targetnames.sort() toolchainlist = EXPORTERS.keys() toolchainlist.sort() parser.add_argument("-m", "--mcu", metavar="MCU", default='LPC1768', type=argparse_many(argparse_force_uppercase_type(targetnames, "MCU")), help="generate project for the given MCU (%s)"% ', '.join(targetnames)) parser.add_argument("-i", dest="ide", default='uvision', type=argparse_force_lowercase_type(toolchainlist, "toolchain"), help="The target IDE: %s"% str(toolchainlist)) parser.add_argument("-c", "--clean", action="store_true", default=False, help="clean the export directory") group = parser.add_mutually_exclusive_group(required=False) group.add_argument("-p",