diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py index b1da8ae4a2..642a589f35 100644 --- a/lib/spack/spack/architecture.py +++ b/lib/spack/spack/architecture.py @@ -69,6 +69,25 @@ def compiler_strategy(self): else: return "PATH" + def to_dict(self): + print "to_dict" + d = {} + d['name'] = self.name + d['module_name'] = self.module_name + if self.architecture: + d['architecture'] = self.architecture + return d + + @staticmethod + def from_dict(d): + print "from_dict" + target = Target.__new__(Target) + target.name = d['name'] + target.module_name = d['module_name'] + if 'architecture' in d: + target.architecture = d['architecture'] + return target + def __str__(self): return self.name diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 3ba9c139a6..395faecde6 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -651,7 +651,7 @@ def to_node_dict(self): d = { 'variants' : dict( (name,v.enabled) for name, v in self.variants.items()), - 'arch' : self.architecture, + 'arch' : self.architecture.to_dict(), 'dependencies' : dict((d, self.dependencies[d].dag_hash()) for d in sorted(self.dependencies)) } @@ -680,7 +680,7 @@ def from_node_dict(node): spec = Spec(name) spec.versions = VersionList.from_dict(node) - spec.architecture = node['arch'] + spec.architecture = spack.architecture.Target.from_dict(node['arch']) if node['compiler'] is None: spec.compiler = None