From 6b037706023c6cc138709d4cbca91d81d32cc4c4 Mon Sep 17 00:00:00 2001 From: Mario Melara Date: Thu, 16 Jun 2016 09:44:37 -0700 Subject: Added str method to mac_osx so that whenever we try to access darwins different operating systems we can grab the name correctly. This avoids having to worry whether we have a version attached to it or not. --- lib/spack/spack/operating_systems/mac_osx.py | 9 ++++----- lib/spack/spack/platforms/darwin.py | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/operating_systems/mac_osx.py b/lib/spack/spack/operating_systems/mac_osx.py index a9de03d2cc..3cf9b4e12e 100644 --- a/lib/spack/spack/operating_systems/mac_osx.py +++ b/lib/spack/spack/operating_systems/mac_osx.py @@ -21,9 +21,8 @@ class MacOsx(OperatingSystem): "10.11": "elcapitan"} mac_ver = py_platform.mac_ver()[0][:-2] - try: - name = mac_releases[mac_ver] - except KeyError: - name = "mac_os" - + name = mac_releases.get(mac_ver, "mac_osx") super(MacOsx, self).__init__(name, mac_ver) + + def __str__(self): + return self.name diff --git a/lib/spack/spack/platforms/darwin.py b/lib/spack/spack/platforms/darwin.py index 7901f82d06..8c8af83d55 100644 --- a/lib/spack/spack/platforms/darwin.py +++ b/lib/spack/spack/platforms/darwin.py @@ -13,11 +13,11 @@ class Darwin(Platform): self.add_target(self.default, Target(self.default)) mac_os = MacOsx() - self.default_os = mac_os.name - self.front_os = mac_os.name - self.back_os = mac_os.name + self.default_os = str(mac_os) + self.front_os = str(mac_os) + self.back_os = str(mac_os) - self.add_operating_system(mac_os.name, mac_os) + self.add_operating_system(str(mac_os), mac_os) @classmethod def detect(self): -- cgit v1.2.3-60-g2f50