Change multimethods to take first match instead of being rigid.

- Formerly required that one and only one spec match
- Now allows first match in a list (more flexible and more intuitive)

- introduces new bug that provides() doesn't do the correct thing
  when a version is not in a range that has been explicitly provided.
- TODO: fix this.
This commit is contained in:
Todd Gamblin
2014-01-07 09:51:51 +01:00
parent 36e6ef9fbd
commit 2f520d6119
5 changed files with 71 additions and 46 deletions

View File

@@ -3,6 +3,8 @@
Developer Guide
=====================
This guide is intended for people who want to work on Spack's inner
workings. Right now it's pretty sparse.
Spec objects
-------------------------

View File

@@ -1060,17 +1060,17 @@ for example:
# the default, called when no @when specs match
pass
@when('mpi@3:')
@when('^mpi@3:')
def setup_mpi(self):
# this will be called when mpi is version 3 or higher
pass
@when('mpi@2:')
@when('^mpi@2:')
def setup_mpi(self):
# this will be called when mpi is version 2 or higher
pass
@when('mpi@1:')
@when('^mpi@1:')
def setup_mpi(self):
# this will be called when mpi is version 1 or higher
pass