예제 #1
0
파일: __main__.py 프로젝트: sgolemon/genny
def main():
    validate_environment()

    # Initialize the global context.
    os_family = platform.system()
    Context.set_triplet_os(os_family)
    args, cmake_args = parser.parse_args(sys.argv[1:], os_family)
    add_args_to_context(args)
    # Pass around Context instead of using the global one to facilitate testing.
    context = Context

    check_venv(args)

    # Execute the minimum amount of code possible to run self tests to minimize
    # untestable code (i.e. code that runs the self-test).
    if args.subcommand == "self-test":
        run_self_test()

    toolchain_downloader = ToolchainDownloader(os_family, args.linux_distro)
    if not toolchain_downloader.fetch_and_install():
        sys.exit(1)
    toolchain_dir = toolchain_downloader.result_dir
    compile_env = context.get_compile_environment(toolchain_dir)

    curator_downloader = CuratorDownloader(os_family, args.linux_distro)
    if not curator_downloader.fetch_and_install():
        sys.exit(1)
    curator_path = curator_downloader.result_dir

    if not args.subcommand:
        logging.info(
            "No subcommand specified; running cmake, compile and install")
        tasks.cmake(context,
                    toolchain_dir=toolchain_dir,
                    env=compile_env,
                    cmdline_cmake_args=cmake_args)
        tasks.compile_all(context, compile_env)
        tasks.install(context, compile_env)
    elif args.subcommand == "clean":
        tasks.clean(context, compile_env)
    else:
        tasks.compile_all(context, compile_env)
        if args.subcommand == "install":
            tasks.install(context, compile_env)
        elif args.subcommand == "cmake-test":
            tasks.run_tests.cmake_test(compile_env)
        elif args.subcommand == "benchmark-test":
            tasks.run_tests.benchmark_test(compile_env)
        elif args.subcommand == "resmoke-test":
            tasks.run_tests.resmoke_test(
                compile_env,
                suites=args.resmoke_suites,
                mongo_dir=args.resmoke_mongo_dir,
                is_cnats=args.resmoke_cnats,
            )
        else:
            raise ValueError("Unknown subcommand: ", args.subcommand)
예제 #2
0
def main():
    # Check Python version
    if not sys.version_info >= (3, 7):
        logging.error('Please run this script with Python 3.7 or newer')
        sys.exit(1)

    # Initialize the global context.
    os_family = platform.system()
    Context.set_triplet_os(os_family)
    args, cmake_args = parser.parse_args(sys.argv[1:], os_family)
    add_args_to_context(args)
    # Pass around Context instead of using the global one to facilitate testing.
    context = Context

    # Execute the minimum amount of code possible to run self tests to minimize
    # untestable code (i.e. code that runs the self-test).
    if args.subcommand == 'self-test':
        run_self_test()

    url = get_toolchain_url(os_family, args.linux_distro)
    toolchain_dir = fetch_and_install_toolchain(url, Context.TOOLCHAIN_ROOT)
    compile_env = context.get_compile_environment(toolchain_dir)

    if not args.subcommand:
        logging.info(
            'No subcommand specified; running cmake, compile and install')
        tasks.cmake(context,
                    toolchain_dir=toolchain_dir,
                    env=compile_env,
                    cmdline_cmake_args=cmake_args)
        tasks.compile_all(context, compile_env)
        tasks.install(context, compile_env)
    elif args.subcommand == 'clean':
        tasks.clean(context, compile_env)
    else:
        tasks.compile_all(context, compile_env)

        if args.subcommand == 'install':
            tasks.install(context, compile_env)
        elif args.subcommand == 'cmake-test':
            tasks.run_tests.cmake_test(compile_env)
        elif args.subcommand == 'benchmark-test':
            tasks.run_tests.benchmark_test(compile_env)
        elif args.subcommand == 'resmoke-test':
            tasks.run_tests.resmoke_test(compile_env,
                                         suites=args.resmoke_suites,
                                         mongo_dir=args.resmoke_mongo_dir,
                                         is_cnats=args.resmoke_cnats)
        else:
            raise ValueError('Unknown subcommand: ', args.subcommand)
예제 #3
0
파일: __main__.py 프로젝트: vrachev/genny
def main():
    # Initialize the global context.
    os_family = platform.system()
    Context.set_triplet_os(os_family)
    args, cmake_args = parser.parse_args(sys.argv[1:], os_family)
    add_args_to_context(args)
    # Pass around Context instead of using the global one to facilitate testing.
    context = Context

    # Execute the minimum amount of code possible to run self tests to minimize
    # untestable code (i.e. code that runs the self-test).
    if args.subcommand == 'self-test':
        run_self_test()

    url = get_toolchain_url(os_family, args.linux_distro)
    toolchain_dir = fetch_and_install_toolchain(url, Context.TOOLCHAIN_ROOT)
    compile_env = context.get_compile_environment(toolchain_dir)

    if not args.subcommand:
        logging.info(
            'No subcommand specified; running cmake, compile and install')
        tasks.cmake(context,
                    toolchain_dir=toolchain_dir,
                    env=compile_env,
                    cmdline_cmake_args=cmake_args)
        tasks.compile_all(context, compile_env)
        tasks.install(context, compile_env)
    else:
        # Always compile genny regardless of the subcommand.
        tasks.compile_all(context, compile_env)

    if args.subcommand == 'install':
        tasks.install(context, compile_env)
    elif args.subcommand == 'cmake-test':
        tasks.run_tests.cmake_test(compile_env)
    elif args.subcommand == 'resmoke-test':
        tasks.run_tests.resmoke_test(compile_env,
                                     suites=args.resmoke_suites,
                                     mongo_dir=args.resmoke_mongo_dir,
                                     is_cnats=args.resmoke_cnats)