summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbecker33 <becker33@llnl.gov>2018-03-23 14:41:43 -0700
committerGitHub <noreply@github.com>2018-03-23 14:41:43 -0700
commit1c169ead8b78b11dbafabaa96a1f76b6f7768aa5 (patch)
tree3f5b85976a93a770255cae5804cec92a653383c2
parent5b810579facb503007d2cb7dd4a79c237e670c0f (diff)
downloadspack-1c169ead8b78b11dbafabaa96a1f76b6f7768aa5.tar.gz
spack-1c169ead8b78b11dbafabaa96a1f76b6f7768aa5.tar.bz2
spack-1c169ead8b78b11dbafabaa96a1f76b6f7768aa5.tar.xz
spack-1c169ead8b78b11dbafabaa96a1f76b6f7768aa5.zip
Grab crayos version from PrgEnv module versions (#7583)
-rw-r--r--lib/spack/spack/operating_systems/cnl.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/spack/spack/operating_systems/cnl.py b/lib/spack/spack/operating_systems/cnl.py
index d64e4d06dc..167b31f6e3 100644
--- a/lib/spack/spack/operating_systems/cnl.py
+++ b/lib/spack/spack/operating_systems/cnl.py
@@ -42,12 +42,20 @@ class Cnl(OperatingSystem):
"""
def __init__(self):
- name = 'CNL'
- version = '10'
+ name = 'cnl'
+ version = self._detect_crayos_version()
super(Cnl, self).__init__(name, version)
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):
types = spack.compilers.all_compiler_types()