From bd7c189c123154e88e092eadbbd93b00ce43cc6a Mon Sep 17 00:00:00 2001 From: Mario Melara Date: Wed, 24 Feb 2016 15:37:50 -0800 Subject: [PATCH] Added more comments --- lib/spack/spack/spec.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 0b42498910..c8c114a8b1 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -661,12 +661,14 @@ def to_node_dict(self): 'dependencies' : dict((d, self.dependencies[d].dag_hash()) for d in sorted(self.dependencies)) } + if self.architecture: # TODO: Fix the target.to_dict to account for the tuple # Want it to be a dict of dicts - d['architecture'] = self.architecture.target.to_dict() + d['architecture'] = spack.architecture.to_dict(self.architecture) else: d['architecture'] = None + if self.compiler: d.update(self.compiler.to_dict()) else: @@ -693,8 +695,7 @@ def from_node_dict(node): spec = Spec(name) spec.versions = VersionList.from_dict(node) # TODO: Need to fix the architecture.Target.from_dict - spec.architecture = spack.architecture.Target.from_dict( - node['architecture']) + spec.architecture = spack.architecture.from_dict(node['architecture']) if node['compiler'] is None: spec.compiler = None @@ -1292,17 +1293,17 @@ def add_architecture_from_string(self, arch): for entry in arch_list: if self._is_valid_platform(entry, platform_names): + # If entry is different from platform name then create it. + # else just keep the already instantiated platform class if entry != platform.name: platform = platform_dict[entry]() # Create instance of platform elif self._is_valid_target(entry, platform): target = platform.target(entry) - # Need to figure out if we're supporting arbitrary os's and how - # to account for them - # Not really a good implementation since the user can add - # gibberish and spack will see it as an os + # check if os is valid by checking platform operating sys dict elif self._is_valid_os(entry, platform): platform_os = platform.operating_system(entry) else: + # throw error since entry is unknown raise UnknownArchitectureSpecError(entry) if target is None: