used key_comparator decorator from util.lang to compare targets. Fixes find bug
This commit is contained in:
parent
eb2c083159
commit
e78b8c16be
@ -27,7 +27,7 @@
|
|||||||
import platform as py_platform
|
import platform as py_platform
|
||||||
import inspect
|
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
|
from llnl.util.filesystem import join_path
|
||||||
import llnl.util.tty as tty
|
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.")
|
super(NoSysTypeError, self).__init__("Could not determine sys_type for this machine.")
|
||||||
|
|
||||||
|
|
||||||
|
@key_ordering
|
||||||
class Target(object):
|
class Target(object):
|
||||||
""" Target is the processor of the host machine. The host machine may have different front-end
|
""" 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
|
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
|
@staticmethod
|
||||||
def from_dict(d):
|
def from_dict(d):
|
||||||
print "from_dict"
|
|
||||||
target = Target.__new__(Target)
|
target = Target.__new__(Target)
|
||||||
target.name = d['name']
|
target.name = d['name']
|
||||||
target.module_name = d['module_name']
|
target.module_name = d['module_name']
|
||||||
@ -87,6 +87,10 @@ def from_dict(d):
|
|||||||
# target.architecture = d['architecture']
|
# target.architecture = d['architecture']
|
||||||
return target
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
def _cmp_key(self):
|
||||||
|
return (self.name, self.module_name)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return self.__str__()
|
return self.__str__()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user