Added to_dict back into operating system

This commit is contained in:
Mario Melara 2016-06-07 14:15:28 -07:00
parent 4925be0bc4
commit 5715799d4e

View File

@ -196,6 +196,7 @@ def operating_system(self, name):
return self.operating_sys.get(name, None)
@classmethod
def detect(self):
""" Subclass is responsible for implementing this method.
@ -333,6 +334,12 @@ def find_compiler(self, cmp_cls, *path):
return list(compilers.values())
def to_dict(self):
d = {}
d['name'] = self.name
d['version'] = self.version
return d
@key_ordering
class Arch(object):
@ -410,7 +417,8 @@ def _operating_system_from_dict(os_name, platform=None):
"""
if not platform:
platform = sys_type()
if isinstance(os_name, spack.util.spack_yaml.syaml_dict):
if isinstance(os_name, spack.util.spack_yaml.syaml_dict) or \
isinstance(os_name, dict):
name = os_name['name']
version = os_name['version']
return platform.operating_system(name+version)