Bug fixes from testing spack preferred packages

This commit is contained in:
Matthew LeGendre 2015-05-29 14:57:24 -07:00
parent 8d7b7e5d5d
commit ee68a76a19
2 changed files with 4 additions and 4 deletions

View file

@ -112,9 +112,8 @@ def _spec_compare(self, pkgname, component, a, b, reverse_natural_compare, secon
elif a_index == None and b_index != None: return 1 elif a_index == None and b_index != None: return 1
elif a_index != None and b_index == a_index: return -1 * cmp(a, b) elif a_index != None and b_index == a_index: return -1 * cmp(a, b)
elif a_index != None and b_index != None and a_index != b_index: return cmp(a_index, b_index) elif a_index != None and b_index != None and a_index != b_index: return cmp(a_index, b_index)
elif a < b: return 1 * reverse else: return cmp(a, b) * reverse
elif b < a: return -1 * reverse
else: return 0
# Given a sort order specified by the pkgname/component/second_key, return # Given a sort order specified by the pkgname/component/second_key, return
@ -148,7 +147,7 @@ def version_compare(self, pkgname, a, b):
"""Return less-than-0, 0, or greater than 0 if version a of pkgname is """Return less-than-0, 0, or greater than 0 if version a of pkgname is
respecively less-than, equal-to, or greater-than version b of pkgname. respecively less-than, equal-to, or greater-than version b of pkgname.
One version is less-than another if it is preferred over the other.""" One version is less-than another if it is preferred over the other."""
return self._spec_compare(pkgname, 'version', a, b, False, None) return self._spec_compare(pkgname, 'version', a, b, True, None)
def variant_compare(self, pkgname, a, b): def variant_compare(self, pkgname, a, b):

View file

@ -38,6 +38,7 @@ class Mpich(Package):
version('3.0.2', 'foobarbaz') version('3.0.2', 'foobarbaz')
version('3.0.1', 'foobarbaz') version('3.0.1', 'foobarbaz')
version('3.0', 'foobarbaz') version('3.0', 'foobarbaz')
version('1.0', 'foobarbas')
provides('mpi@:3', when='@3:') provides('mpi@:3', when='@3:')
provides('mpi@:1', when='@:1') provides('mpi@:1', when='@:1')