Skip to content

Commit

Permalink
fix pylint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Oct 1, 2020
1 parent 31e3c8d commit 5bc3f22
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 37 deletions.
69 changes: 34 additions & 35 deletions cime_config/buildexe
Original file line number Diff line number Diff line change
Expand Up @@ -30,75 +30,74 @@ def _main_func():
logger.info("Building a single executable version of target coupled model")

with Case(caseroot) as case:
casetools = case.get_value("CASETOOLS")
cimeroot = case.get_value("CIMEROOT")
exeroot = case.get_value("EXEROOT")
gmake = case.get_value("GMAKE")
gmake_j = case.get_value("GMAKE_J")
cime_model = case.get_value("MODEL")
num_esp = case.get_value("NUM_COMP_INST_ESP")
ocn_model = case.get_value("COMP_OCN")
atm_model = case.get_value("COMP_ATM")
gmake_args = get_standard_makefile_args(case)
casetools = case.get_value("CASETOOLS")
exeroot = case.get_value("EXEROOT")
gmake = case.get_value("GMAKE")
gmake_j = case.get_value("GMAKE_J")
cime_model = case.get_value("MODEL")
num_esp = case.get_value("NUM_COMP_INST_ESP")
ocn_model = case.get_value("COMP_OCN")
atm_model = case.get_value("COMP_ATM")
gmake_args = get_standard_makefile_args(case)

# Determine valid components
valid_comps = []
comp_classes = case.get_values("COMP_CLASSES")
for item in comp_classes:
comp = case.get_value("COMP_" + item)
valid = True
if comp == 's' + item.lower():
valid = False
if valid:
valid_comps.append(item)
comp = case.get_value("COMP_" + item)
valid = True
if comp == 's' + item.lower():
valid = False
if valid:
valid_comps.append(item)

datamodel_in_compset = False
for comp in comp_classes:
dcompname = "d"+comp.lower()
if dcompname in case.get_value("COMP_{}".format(comp)):
datamodel_in_compset = True
dcompname = "d"+comp.lower()
if dcompname in case.get_value("COMP_{}".format(comp)):
datamodel_in_compset = True

if len(valid_comps) == 2 and not datamodel_in_compset:
skip_mediator = True
skip_mediator = True
else:
skip_mediator = False
skip_mediator = False

if ocn_model == 'mom' or atm_model == "ufsatm":
gmake_args += "USE_FMS=TRUE"
gmake_args += "USE_FMS=TRUE"

comp_classes = case.get_values("COMP_CLASSES")
for comp in comp_classes:
model = case.get_value("COMP_{}".format(comp))
stubcomp = "s{}".format(comp.lower())
if model == stubcomp:
gmake_args += " {}_PRESENT=FALSE".format(comp)
model = case.get_value("COMP_{}".format(comp))
stubcomp = "s{}".format(comp.lower())
if model == stubcomp:
gmake_args += " {}_PRESENT=FALSE".format(comp)
if skip_mediator:
gmake_args += " MED_PRESENT=FALSE"
gmake_args += " MED_PRESENT=FALSE"

gmake_args += " IAC_PRESENT=FALSE"
expect((num_esp is None) or (int(num_esp) == 1), "ESP component restricted to one instance")

bld_root = os.path.join(exeroot,'cpl','obj')
if not os.path.isdir(bld_root):
os.makedirs(bld_root)
os.makedirs(bld_root)

with open(os.path.join(bld_root,'Filepath'), 'w') as out:
cmeps_dir = os.path.join(os.path.dirname(__file__), os.pardir)
if not skip_mediator:
out.write(os.path.join(cmeps_dir, "mediator") + "\n")
out.write(os.path.join(caseroot, "SourceMods", "src.drv") + "\n")
out.write(os.path.join(cmeps_dir, "drivers", "cime") + "\n")
cmeps_dir = os.path.join(os.path.dirname(__file__), os.pardir)
if not skip_mediator:
out.write(os.path.join(cmeps_dir, "mediator") + "\n")
out.write(os.path.join(caseroot, "SourceMods", "src.drv") + "\n")
out.write(os.path.join(cmeps_dir, "drivers", "cime") + "\n")

# build model executable
makefile = os.path.join(casetools, "Makefile")
exename = os.path.join(exeroot, cime_model + ".exe")

# always relink
if os.path.isfile(exename):
os.remove(exename)
os.remove(exename)

cmd = "{} exec_se -j {} EXEC_SE={} MODEL=driver {} -f {} "\
.format(gmake, gmake_j, exename, gmake_args, makefile)
.format(gmake, gmake_j, exename, gmake_args, makefile)


rc, out, err = run_cmd(cmd,from_dir=bld_root)
Expand Down
5 changes: 3 additions & 2 deletions tcipylint
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env sh
args="--disable=I,C,R,logging-not-lazy,wildcard-import,unused-wildcard-import,fixme,broad-except,bare-except,eval-used,exec-used,global-statement,logging-format-interpolation,no-name-in-module,import-error"
failed=0
for file in cime_config/buildexe cime_config/buildnml cime_config/runseq/*
do
pylint $args $file || exit $?
pylint $args $file || failed=$failed+1
done
exit 0
exit $failed

0 comments on commit 5bc3f22

Please sign in to comment.