def main()

in build/fbcode_builder/CMake/make_fbpy_archive.py [0:0]


def main():
    ap = argparse.ArgumentParser()
    ap.add_argument("-o", "--output", required=True, help="The output file path")
    ap.add_argument(
        "--install-dir",
        help="When used with --type=lib-install, this parameter specifies the "
        "final location where the library where be installed.  This can be "
        "used to generate the library in one directory first, when you plan "
        "to move or copy it to another final location later.",
    )
    ap.add_argument(
        "--manifest-separator",
        help="Split manifest arguments around this separator.  This is used "
        "to support older versions of CMake that cannot supply the manifests "
        "as separate arguments.",
    )
    ap.add_argument(
        "--main",
        help="The main module to run, specified as <module>:<callable>.  "
        "This must be specified if and only if the archive does not contain "
        "a __main__.py file.",
    )
    ap.add_argument(
        "--python",
        help="Explicitly specify the python interpreter to use for the " "executable.",
    )
    ap.add_argument(
        "--type", choices=BUILD_TYPES.keys(), help="The type of output to build."
    )
    ap.add_argument(
        "manifests",
        nargs="+",
        help="The manifest files specifying how to construct the archive",
    )
    args = ap.parse_args()

    if args.python is None:
        args.python = sys.executable

    if args.type is None:
        # In the future we might want different default output types
        # for different platforms.
        args.type = "zipapp"
    build_fn = BUILD_TYPES[args.type]

    try:
        path_map = parse_manifests(args)
        check_main_module(args, path_map)
    except UsageError as ex:
        print("error: %s" % (ex,), file=sys.stderr)
        sys.exit(1)

    build_fn(args, path_map)