used key_comparator decorator from util.lang to compare targets. Fixes find bug

This commit is contained in:
Gregory Becker 2015-11-12 13:27:10 -08:00
parent eb2c083159
commit e78b8c16be

View File

@ -27,7 +27,7 @@
import platform as py_platform
import inspect
from llnl.util.lang import memoized, list_modules
from llnl.util.lang import memoized, list_modules, key_ordering
from llnl.util.filesystem import join_path
import llnl.util.tty as tty
@ -47,6 +47,7 @@ def __init__(self):
super(NoSysTypeError, self).__init__("Could not determine sys_type for this machine.")
@key_ordering
class Target(object):
""" Target is the processor of the host machine. The host machine may have different front-end
and back-end targets, especially if it is a Cray machine. The target will have a name and
@ -79,7 +80,6 @@ def to_dict(self):
@staticmethod
def from_dict(d):
print "from_dict"
target = Target.__new__(Target)
target.name = d['name']
target.module_name = d['module_name']
@ -87,6 +87,10 @@ def from_dict(d):
# target.architecture = d['architecture']
return target
def _cmp_key(self):
return (self.name, self.module_name)
def __repr__(self):
return self.__str__()