From 0a92349f90703bb21e58d8e46d7027d654d31eff Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sun, 7 Jun 2015 15:40:01 -0700 Subject: 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. --- lib/spack/spack/concretize.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py index 15e886ad3c..2e1d5d7f03 100644 --- a/lib/spack/spack/concretize.py +++ b/lib/spack/spack/concretize.py @@ -75,7 +75,23 @@ class DefaultConcretizer(object): 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 @@ class UnavailableCompilerVersionError(spack.error.SpackError): 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)) -- cgit v1.2.3-70-g09d2