summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2015-06-07 15:40:01 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2015-06-07 15:40:01 -0700
commit0a92349f90703bb21e58d8e46d7027d654d31eff (patch)
treed9ed3a9b937e6dce4730034c14aca97795bb10d6 /lib
parent3f3ceb24c49b8d466048491743e9628bab44f46a (diff)
downloadspack-0a92349f90703bb21e58d8e46d7027d654d31eff.tar.gz
spack-0a92349f90703bb21e58d8e46d7027d654d31eff.tar.bz2
spack-0a92349f90703bb21e58d8e46d7027d654d31eff.tar.xz
spack-0a92349f90703bb21e58d8e46d7027d654d31eff.zip
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/concretize.py24
1 files changed, 20 insertions, 4 deletions
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))