Grab crayos version from PrgEnv module versions (#7583)

This commit is contained in:
becker33 2018-03-23 14:41:43 -07:00 committed by GitHub
parent 5b810579fa
commit 1c169ead8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,12 +42,20 @@ class Cnl(OperatingSystem):
""" """
def __init__(self): def __init__(self):
name = 'CNL' name = 'cnl'
version = '10' version = self._detect_crayos_version()
super(Cnl, self).__init__(name, version) super(Cnl, self).__init__(name, version)
def __str__(self): def __str__(self):
return self.name return self.name + str(self.version)
def _detect_crayos_version(self):
modulecmd = get_module_cmd()
output = modulecmd("avail", "PrgEnv-", output=str, error=str)
matches = re.findall(r'PrgEnv-\w+/(\d+).\d+.\d+', output)
major_versions = set(matches)
latest_version = max(major_versions)
return latest_version
def find_compilers(self, *paths): def find_compilers(self, *paths):
types = spack.compilers.all_compiler_types() types = spack.compilers.all_compiler_types()