Esempio n. 1
0
def get_all_checkable_files():
    ###############################################################################
    cimeroot = get_cime_root()
    all_git_files = run_cmd_no_fail("git ls-files",
                                    from_dir=cimeroot,
                                    verbose=False).splitlines()
    if get_cime_default_driver() == "nuopc":
        srcroot = get_src_root()
        nuopc_git_files = []
        try:
            nuopc_git_files = run_cmd_no_fail(
                "git ls-files",
                from_dir=os.path.join(srcroot, "components", "cmeps"),
                verbose=False,
            ).splitlines()
        except:
            logger.warning("No nuopc driver found in source")
        all_git_files.extend([
            os.path.join(srcroot, "components", "cmeps", _file)
            for _file in nuopc_git_files
        ])
    files_to_test = [
        item for item in all_git_files
        if ((item.endswith(".py") or is_python_executable(
            os.path.join(cimeroot, item))) and not _should_pylint_skip(item))
    ]

    return files_to_test
Esempio n. 2
0
def _build_model_thread(
    config_dir,
    compclass,
    compname,
    caseroot,
    libroot,
    bldroot,
    incroot,
    file_build,
    thread_bad_results,
    smp,
    compiler,
):
    ###############################################################################
    logger.info("Building {} with output to {}".format(compclass, file_build))
    t1 = time.time()
    cmd = os.path.join(caseroot, "SourceMods", "src." + compname, "buildlib")
    if os.path.isfile(cmd):
        logger.warning(
            "WARNING: using local buildlib script for {}".format(compname))
    else:
        cmd = os.path.join(config_dir, "buildlib")
        expect(os.path.isfile(cmd),
               "Could not find buildlib for {}".format(compname))

    compile_cmd = "COMP_CLASS={compclass} COMP_NAME={compname} {cmd} {caseroot} {libroot} {bldroot} ".format(
        compclass=compclass,
        compname=compname,
        cmd=cmd,
        caseroot=caseroot,
        libroot=libroot,
        bldroot=bldroot,
    )
    if get_model() != "ufs":
        compile_cmd = "SMP={} {}".format(stringify_bool(smp), compile_cmd)

    if is_python_executable(cmd):
        logging_options = get_logging_options()
        if logging_options != "":
            compile_cmd = compile_cmd + logging_options

    with open(file_build, "w") as fd:
        stat = run_cmd(compile_cmd,
                       from_dir=bldroot,
                       arg_stdout=fd,
                       arg_stderr=subprocess.STDOUT)[0]

    if stat != 0:
        thread_bad_results.append(
            "BUILD FAIL: {}.buildlib failed, cat {}".format(
                compname, file_build))

    analyze_build_log(compclass, file_build, compiler)

    for mod_file in glob.glob(os.path.join(bldroot,
                                           "*_[Cc][Oo][Mm][Pp]_*.mod")):
        safe_copy(mod_file, incroot)

    t2 = time.time()
    logger.info("{} built in {:f} seconds".format(compname, (t2 - t1)))
Esempio n. 3
0
def get_all_checkable_files():
###############################################################################
    cimeroot = get_cime_root()
    all_git_files = run_cmd_no_fail("git ls-files", from_dir=cimeroot, verbose=False).splitlines()

    files_to_test = [item for item in all_git_files
                     if ((item.endswith(".py") or is_python_executable(os.path.join(cimeroot, item))) and not _should_pylint_skip(item))]
    return files_to_test
Esempio n. 4
0
def get_all_checkable_files():
###############################################################################
    cimeroot = get_cime_root()
    all_git_files = run_cmd_no_fail("git ls-files", from_dir=cimeroot, verbose=False).splitlines()

    files_to_test = [item for item in all_git_files
                     if ((item.endswith(".py") or is_python_executable(os.path.join(cimeroot, item))) and not _should_pylint_skip(item))]
    return files_to_test
Esempio n. 5
0
def get_all_checkable_files():
    ###############################################################################
    cimeroot = get_cime_root()
    all_git_files = run_cmd_no_fail("git ls-files",
                                    from_dir=cimeroot,
                                    verbose=False).splitlines()
    if get_cime_default_driver() == "nuopc":
        nuopc_git_files = run_cmd_no_fail("git ls-files",
                                          from_dir=os.path.join(
                                              cimeroot, "src", "drivers",
                                              "nuopc"),
                                          verbose=False).splitlines()
        all_git_files.extend([
            os.path.join("src", "drivers", "nuopc", _file)
            for _file in nuopc_git_files
        ])
    files_to_test = [
        item for item in all_git_files
        if ((item.endswith(".py") or is_python_executable(
            os.path.join(cimeroot, item))) and not _should_pylint_skip(item))
    ]

    return files_to_test