Multi-valued variants (#2386)

Modifications:
- added support for multi-valued variants
- refactored code related to variants into variant.py
- added new generic features to AutotoolsPackage that leverage multi-valued variants
- modified openmpi to use new features
- added unit tests for the new semantics
This commit is contained in:
Massimiliano Culpo
2017-05-01 22:08:47 +02:00
committed by Todd Gamblin
parent 5d0d670b72
commit 9e4b0eb34a
22 changed files with 1959 additions and 436 deletions

View File

@@ -266,10 +266,28 @@ def setter(name, value):
@key_ordering
class HashableMap(dict):
class HashableMap(collections.MutableMapping):
"""This is a hashable, comparable dictionary. Hash is performed on
a tuple of the values in the dictionary."""
def __init__(self):
self.dict = {}
def __getitem__(self, key):
return self.dict[key]
def __setitem__(self, key, value):
self.dict[key] = value
def __iter__(self):
return iter(self.dict)
def __len__(self):
return len(self.dict)
def __delitem__(self, key):
del self.dict[key]
def _cmp_key(self):
return tuple(sorted(self.values()))

View File

@@ -22,22 +22,22 @@
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import sys
import os
import textwrap
import fcntl
import termios
import os
import struct
import sys
import termios
import textwrap
import traceback
from six import StringIO
from six.moves import input
from llnl.util.tty.color import *
_debug = False
_debug = False
_verbose = False
_stacktrace = False
indent = " "
indent = " "
def is_verbose():
@@ -100,7 +100,7 @@ def msg(message, *args, **kwargs):
def info(message, *args, **kwargs):
format = kwargs.get('format', '*b')
stream = kwargs.get('stream', sys.stdout)
wrap = kwargs.get('wrap', False)
wrap = kwargs.get('wrap', False)
break_long_words = kwargs.get('break_long_words', False)
st_countback = kwargs.get('countback', 3)
@@ -218,7 +218,7 @@ def hline(label=None, **kwargs):
char (str): Char to draw the line with. Default '-'
max_width (int): Maximum width of the line. Default is 64 chars.
"""
char = kwargs.pop('char', '-')
char = kwargs.pop('char', '-')
max_width = kwargs.pop('max_width', 64)
if kwargs:
raise TypeError(