Skip to content

Commit

Permalink
Update buildlib, buildlib_2.1, buildlib_2.2 (#458)
Browse files Browse the repository at this point in the history
The "imp" module is deprecated in favour of importlib.
Updating release-1.6 branch according to changes in master branch.
  • Loading branch information
TomasTorsvik authored Dec 27, 2024
1 parent 9d40d5c commit 94f1279
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cime_config/buildlib
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
build blom library
"""
import os, shutil, sys, glob, imp
import os, sys

_CIMEROOT = os.environ.get("CIMEROOT")
if _CIMEROOT is None:
Expand Down
5 changes: 3 additions & 2 deletions cime_config/buildlib_2.1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"""
build blom library
"""
import os, shutil, sys, glob, imp
import os, shutil, sys, glob
from importlib.machinery import SourceFileLoader

_CIMEROOT = os.environ.get("CIMEROOT")
if _CIMEROOT is None:
Expand Down Expand Up @@ -32,7 +33,7 @@ def _main_func():
cmd = os.path.join(os.path.join(comp_root_dir_ocn, "cime_config", "buildcpp"))
logger.info(" ...calling blom buildcpp to set build time options")
try:
mod = imp.load_source("buildcpp", cmd)
mod = SourceFileLoader("buildcpp", cmd).load_module()
blom_cppdefs = mod.buildcpp(case)
except:
raise
Expand Down
5 changes: 3 additions & 2 deletions cime_config/buildlib_2.2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"""
build blom library
"""
import os, shutil, sys, glob, imp
import os, shutil, sys, glob
from importlib.machinery import SourceFileLoader

_CIMEROOT = os.environ.get("CIMEROOT")
if _CIMEROOT is None:
Expand Down Expand Up @@ -33,7 +34,7 @@ def _main_func():
cmd = os.path.join(os.path.join(comp_root_dir_ocn, "cime_config", "buildcpp"))
logger.info(" ...calling blom buildcpp to set build time options")
try:
mod = imp.load_source("buildcpp", cmd)
mod = SourceFileLoader("buildcpp", cmd).load_module()
blom_cppdefs = mod.buildcpp(case)
except:
raise
Expand Down

0 comments on commit 94f1279

Please sign in to comment.