Changed name to appropriate camelcase

This commit is contained in:
Mario Melara 2016-02-24 15:31:21 -08:00
parent 9e844d974c
commit 2de81cfc62
3 changed files with 20 additions and 32 deletions

View file

@ -1,7 +1,7 @@
import spack import spack
from spack.architecture import OperatingSystem from spack.architecture import OperatingSystem
class ComputeNodeLinux(OperatingSystem): class Cnl(OperatingSystem):
""" Compute Node Linux (CNL) is the operating system used for the Cray XC """ Compute Node Linux (CNL) is the operating system used for the Cray XC
series super computers. It is a very stripped down version of GNU/Linux. series super computers. It is a very stripped down version of GNU/Linux.
Any compilers found through this operating system will be used with Any compilers found through this operating system will be used with
@ -11,7 +11,7 @@ class ComputeNodeLinux(OperatingSystem):
def __init__(self): def __init__(self):
name = 'CNL' name = 'CNL'
version = '10' version = '10'
super(ComputeNodeLinux, self).__init__(name, version, "MODULES") super(Cnl, self).__init__(name, version, "MODULES")
def compiler_strategy(self): def compiler_strategy(self):
return self.compiler_strategy return self.compiler_strategy

View file

@ -1,6 +1,6 @@
import platform as py_platform import platform as py_platform
import spack import spack
from spack.architecture import Platform, OperatingSystem from spack.architecture import OperatingSystem
class LinuxDistro(OperatingSystem): class LinuxDistro(OperatingSystem):
""" This class will represent the autodetected operating system """ This class will represent the autodetected operating system
@ -10,12 +10,8 @@ class LinuxDistro(OperatingSystem):
platform.dist() platform.dist()
""" """
def __init__(self): def __init__(self):
def detect_operating_system(): name = py_platform.dist()[0]
name = py_platform.dist()[0] version = py_platform.dist()[1]
version = py_platform.dist()[1]
return name, version
name, version = detect_operating_system()
super(LinuxDistro, self).__init__(name, version, "PATH") super(LinuxDistro, self).__init__(name, version, "PATH")

View file

@ -3,38 +3,30 @@
will be represented using the major version operating system name, i.e will be represented using the major version operating system name, i.e
el capitan, yosemite...etc. el capitan, yosemite...etc.
""" """
import spack
import os
import platform as py_platform import platform as py_platform
from spack.architecture import Platform, OperatingSystem import spack
from spack.architecture import OperatingSystem
class MacOSX(OperatingSystem): class MacOsx(OperatingSystem):
def __init__(self): def __init__(self):
""" Autodetects the mac version from a dictionary. Goes back as """ Autodetects the mac version from a dictionary. Goes back as
far as 10.6 snowleopard. If the user has an older mac then far as 10.6 snowleopard. If the user has an older mac then
the version will just be a generic mac_os. the version will just be a generic mac_os.
""" """
mac_releases = {'10.6': "snowleopard",
"10.7": "lion",
"10.8": "mountainlion",
"10.9": "mavericks",
"10.10": "yosemite",
"10.11": "elcapitan"}
def get_mac_release(): mac_ver = py_platform.mac_ver()[0][:-2]
mac_releases = {'10.6': "snowleopard", try:
"10.7": "lion", name = mac_releases[mac_ver]
"10.8": "mountainlion", except KeyError:
"10.9": "mavericks", name = "mac_os"
"10.10": "yosemite",
"10.11": "elcapitan"}
mac_ver = py_platform.mac_ver()[0][:-2] super(MacOsx, self).__init__(name, mac_ver, "PATH")
try:
name = mac_releases[mac_ver]
return name, mac_ver
except KeyError:
name = "mac_os"
return name, mac_ver
name, version = get_mac_release()
super(MacOSX, self).__init__(name, version, "PATH")
def compiler_strategy(self): def compiler_strategy(self):
return self.compiler_strategy return self.compiler_strategy