Skip to content

Commit

Permalink
Improve spec failure messages on multiple versions (spack#51)
Browse files Browse the repository at this point in the history
* Improve spec failure messagees on multiple versions

* Fix style
  • Loading branch information
greenc-FNAL authored Oct 20, 2022
1 parent 23b37da commit f34f67d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/spack/spack/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,8 @@ def _add_versions(self, version_list):
# Note: This may be impossible to reach by the current parser
# Keeping it in case the implementation changes.
raise MultipleVersionError(
"A spec cannot contain multiple version signifiers." " Use a version list instead."
"A spec ({0}) cannot contain multiple version signifiers. "
"Use a version list instead.".format(self)
)
self.versions = vn.VersionList()
for version in version_list:
Expand Down Expand Up @@ -1396,7 +1397,8 @@ def _add_versions(self, version_list):
# If it already has a non-trivial version list, this is an error
if self.versions and self.versions != vn.VersionList(":"):
raise MultipleVersionError(
"A spec cannot contain multiple version signifiers." " Use a version list instead."
"A spec ({0}) cannot contain multiple version signifiers. "
"Use a version list instead.".format(self)
)
self.versions = vn.VersionList()
for version in version_list:
Expand Down

0 comments on commit f34f67d

Please sign in to comment.