summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorsimon-Leary42 <90859533+simon-Leary42@users.noreply.github.com>2023-02-21 07:50:56 -0500
committerGitHub <noreply@github.com>2023-02-21 04:50:56 -0800
commit33bf1fd033af872d60f3878aaac3318c78ae2719 (patch)
treece2eb91776a6f4513fddc2064de86ea2baa4605c /lib
parent5b8917188a4d84713c1037fd9464bf77503edd27 (diff)
downloadspack-33bf1fd033af872d60f3878aaac3318c78ae2719.tar.gz
spack-33bf1fd033af872d60f3878aaac3318c78ae2719.tar.bz2
spack-33bf1fd033af872d60f3878aaac3318c78ae2719.tar.xz
spack-33bf1fd033af872d60f3878aaac3318c78ae2719.zip
nonexistent module concise error message (#35502)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/modules/common.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/spack/spack/modules/common.py b/lib/spack/spack/modules/common.py
index 53779fc878..e2eda7982c 100644
--- a/lib/spack/spack/modules/common.py
+++ b/lib/spack/spack/modules/common.py
@@ -399,13 +399,19 @@ def get_module(module_type, spec, get_full_path, module_set_name="default", requ
else:
writer = spack.modules.module_types[module_type](spec, module_set_name)
if not os.path.isfile(writer.layout.filename):
+ fmt_str = "{name}{@version}{/hash:7}"
if not writer.conf.excluded:
- err_msg = "No module available for package {0} at {1}".format(
- spec, writer.layout.filename
+ raise ModuleNotFoundError(
+ "The module for package {} should be at {}, but it does not exist".format(
+ spec.format(fmt_str), writer.layout.filename
+ )
)
- raise ModuleNotFoundError(err_msg)
elif required:
- tty.debug("The module configuration has excluded {0}: " "omitting it".format(spec))
+ tty.debug(
+ "The module configuration has excluded {}: omitting it".format(
+ spec.format(fmt_str)
+ )
+ )
else:
return None