Skip to content
Snippets Groups Projects
Commit d7d61df3 authored by Martin Lang's avatar Martin Lang
Browse files

Missing yaml.Loader; controlled failure if module file incomplete

parent 41f54ef6
No related branches found
No related tags found
1 merge request!1Code review of main
Pipeline #582740 failed
...@@ -349,7 +349,15 @@ def refresh_modules(compilers: dict[str, Any] | None = None) -> None: ...@@ -349,7 +349,15 @@ def refresh_modules(compilers: dict[str, Any] | None = None) -> None:
r'depends_on\("(intel-oneapi-compilers/[0-9.]+)"\)', classic_content r'depends_on\("(intel-oneapi-compilers/[0-9.]+)"\)', classic_content
) )
# match.group(1) will fail should we not find the line (should never happen) # match.group(1) will fail should we not find the line (should never happen)
oneapi_module = match.group(1) + ".lua" try:
oneapi_module = match.group(1) + ".lua"
except (AttributeError, IndexError) as e:
logger.error(
"Failed to find 'depends_on(intel-oneapi-compilers/...)' in '%s'",
module_file,
classic_content,
)
raise ModuleGenerationError() from e
oneapi_module_file = Config().lmod_root / "Core" / oneapi_module oneapi_module_file = Config().lmod_root / "Core" / oneapi_module
modules_to_patch[oneapi_module_file] = { modules_to_patch[oneapi_module_file] = {
"family": ONEAPI_FAMILY, "family": ONEAPI_FAMILY,
...@@ -362,7 +370,7 @@ def refresh_modules(compilers: dict[str, Any] | None = None) -> None: ...@@ -362,7 +370,7 @@ def refresh_modules(compilers: dict[str, Any] | None = None) -> None:
# patch all intel modules # patch all intel modules
try: try:
with open(to_patch_file) as f: with open(to_patch_file) as f:
modules_to_patch = yaml.load(f) modules_to_patch = yaml.load(f, loader=yaml.Loader)
except FileNotFoundError: except FileNotFoundError:
logger.debug("No intel modules to patch") logger.debug("No intel modules to patch")
return return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment