Try a little harder in concretize_version() -- concretize unsafe versions too.
- This can result in the user being prompted to download an unsafe version. - Avoids overly strict errors when something *could* be satisfiable but we don't know about hte version.
This commit is contained in:
parent
3f3ceb24c4
commit
0a92349f90
@ -75,7 +75,23 @@ def concretize_version(self, spec):
|
||||
if valid_versions:
|
||||
spec.versions = ver([valid_versions[-1]])
|
||||
else:
|
||||
raise NoValidVersionError(spec)
|
||||
# We don't know of any SAFE versions that match the given
|
||||
# spec. Grab the spec's versions and grab the highest
|
||||
# *non-open* part of the range of versions it specifies.
|
||||
# Someone else can raise an error if this happens,
|
||||
# e.g. when we go to fetch it and don't know how. But it
|
||||
# *might* work.
|
||||
if not spec.versions or spec.versions == VersionList([':']):
|
||||
raise NoValidVersionError(spec)
|
||||
else:
|
||||
last = spec.versions[-1]
|
||||
if isinstance(last, VersionRange):
|
||||
if last.end:
|
||||
spec.versions = ver([last.end])
|
||||
else:
|
||||
spec.versions = ver([last.start])
|
||||
else:
|
||||
spec.versions = ver([last])
|
||||
|
||||
|
||||
def concretize_architecture(self, spec):
|
||||
@ -174,8 +190,8 @@ def __init__(self, compiler_spec):
|
||||
|
||||
|
||||
class NoValidVersionError(spack.error.SpackError):
|
||||
"""Raised when there is no available version for a package that
|
||||
satisfies a spec."""
|
||||
"""Raised when there is no way to have a concrete version for a
|
||||
particular spec."""
|
||||
def __init__(self, spec):
|
||||
super(NoValidVersionError, self).__init__(
|
||||
"No available version of %s matches '%s'" % (spec.name, spec.versions))
|
||||
"There are no valid versions for %s that match '%s'" % (spec.name, spec.versions))
|
||||
|
Loading…
Reference in New Issue
Block a user