Skip to content

Commit

Permalink
Merge pull request #233 from jedwards4b/black_format_python
Browse files Browse the repository at this point in the history
black reformat these python files
  • Loading branch information
jedwards4b authored May 17, 2023
2 parents af2a809 + 1ca35a5 commit aa77161
Show file tree
Hide file tree
Showing 3 changed files with 262 additions and 141 deletions.
4 changes: 1 addition & 3 deletions cime_config/buildlib
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ def buildlib(bldroot, libroot, case):

logger.info("Running cmake for CDEPS")
srcpath = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
cmake_flags = get_standard_cmake_args(
case, os.path.join(sharedpath, "cdeps")
)
cmake_flags = get_standard_cmake_args(case, os.path.join(sharedpath, "cdeps"))
# base path of install to be completed by setting DESTDIR in make install
cmake_flags += " -DCMAKE_INSTALL_PREFIX:PATH=/"
cmake_flags += " -DLIBROOT={} ".format(libroot)
Expand Down
22 changes: 15 additions & 7 deletions cime_config/buildlib_comps
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,44 @@ if _CIMEROOT is None:
raise SystemExit("ERROR: must set CIMEROOT environment variable")
sys.path.append(os.path.join(_CIMEROOT, "CIME", "Tools"))

_LIBDIR = os.path.join(_CIMEROOT, "scripts", "lib")
_LIBDIR = os.path.join(_CIMEROOT, "CIME")
sys.path.append(_LIBDIR)

from standard_script_setup import *
from CIME.buildlib import parse_input
from CIME.case import Case
from CIME.utils import run_cmd, symlink_force, expect

# pragma pylint: disable=unused-argument,undefined-variable

logger = logging.getLogger(__name__)


def buildlib(bldroot, libroot, case, compname=None):
if not compname:
expect(bldroot.endswith("obj"),
"It appears that buildlib_comps is being called for the main CDEPS build\n"
"(the main CDEPS build should use buildlib, not buildlib_comps)")
compname = os.path.basename(os.path.abspath(os.path.join(bldroot,os.pardir)))
expect(
bldroot.endswith("obj"),
"It appears that buildlib_comps is being called for the main CDEPS build\n"
"(the main CDEPS build should use buildlib, not buildlib_comps)",
)
compname = os.path.basename(os.path.abspath(os.path.join(bldroot, os.pardir)))

_, o, e = run_cmd("make d{}".format(compname), from_dir=bldroot, verbose=True)
libname = "lib{}.a".format(compname)
dlibname = "libd{}.a".format(compname)
dlibpath = os.path.join(bldroot, dlibname)
if os.path.exists(dlibpath):
symlink_force(os.path.join(bldroot,dlibname), os.path.join(libroot,libname))
symlink_force(os.path.join(bldroot, dlibname), os.path.join(libroot, libname))
else:
expect(False, "ERROR in {} build {} {}".format(compname,o,e))
expect(False, "ERROR in {} build {} {}".format(compname, o, e))
logger.info(f"build successful for comp={compname}")


def _main_func(args):
caseroot, libroot, bldroot = parse_input(args)
with Case(caseroot) as case:
buildlib(bldroot, libroot, case)


if __name__ == "__main__":
_main_func(sys.argv)
Loading

0 comments on commit aa77161

Please sign in to comment.