used key_comparator decorator from util.lang to compare targets. Fixes find bug
This commit is contained in:
		| @@ -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__() | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Gregory Becker
					Gregory Becker