summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGregory Becker <becker33@llnl.gov>2016-05-26 11:14:05 -0700
committerGregory Becker <becker33@llnl.gov>2016-05-26 11:14:05 -0700
commitb968603a57a4085b05318c295443d370f4b4c270 (patch)
tree7ac3edfbf70673734925e51c7a49f765d4245c61 /lib
parent3b675d8b700369a5b5282e56ecaf6c559e592551 (diff)
downloadspack-b968603a57a4085b05318c295443d370f4b4c270.tar.gz
spack-b968603a57a4085b05318c295443d370f4b4c270.tar.bz2
spack-b968603a57a4085b05318c295443d370f4b4c270.tar.xz
spack-b968603a57a4085b05318c295443d370f4b4c270.zip
made yaml format backwards compatible
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/architecture.py38
-rw-r--r--lib/spack/spack/operating_systems/pre_v1.py17
-rw-r--r--lib/spack/spack/platforms/spack_compatibility.py23
3 files changed, 62 insertions, 16 deletions
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py
index 5d16a2f5f5..86733ba418 100644
--- a/lib/spack/spack/architecture.py
+++ b/lib/spack/spack/architecture.py
@@ -90,7 +90,7 @@ from spack.util.naming import mod_to_class
from spack.util.environment import get_path
from spack.util.multiproc import parmap
import spack.error as serr
-
+import spack.platforms
class InvalidSysTypeError(serr.SpackError):
def __init__(self, sys_type):
@@ -462,21 +462,27 @@ def arch_from_dict(d):
"""
arch = Arch()
- if d is None:
- return None
- platform_dict = d['platform']
- os_dict = d['platform_os']
- target_dict = d['target']
-
- platform = _platform_from_dict(platform_dict) if platform_dict else None
- target = _target_from_dict(target_dict) if os_dict else None
- platform_os = _operating_system_from_dict(os_dict) if os_dict else None
- arch.platform = platform
- arch.target = target
- arch.platform_os = platform_os
-
- arch.os_string = None
- arch.target_string = None
+ if isinstance(d, basestring):
+ # We have an old spec using a string for the architecture
+ arch.platform = spack.platforms.spack_compatibility.SpackCompatibility()
+ arch.platform_os = arch.platform.operating_system('default')
+ arch.target = Target(d)
+
+ arch.os_string = None
+ arch.target_string = None
+ else:
+ if d is None:
+ return None
+ platform_dict = d['platform']
+ os_dict = d['platform_os']
+ target_dict = d['target']
+
+ arch.platform = _platform_from_dict(platform_dict) if platform_dict else None
+ arch.target = _target_from_dict(target_dict) if os_dict else None
+ arch.platform_os = _operating_system_from_dict(os_dict) if os_dict else None
+
+ arch.os_string = None
+ arch.target_string = None
return arch
diff --git a/lib/spack/spack/operating_systems/pre_v1.py b/lib/spack/spack/operating_systems/pre_v1.py
new file mode 100644
index 0000000000..71ee557ac1
--- /dev/null
+++ b/lib/spack/spack/operating_systems/pre_v1.py
@@ -0,0 +1,17 @@
+import re
+import os
+
+from spack.architecture import OperatingSystem
+
+
+class PreV1(OperatingSystem):
+ """ 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.
+ Any compilers found through this operating system will be used with
+ modules. If updated, user must make sure that version and name are
+ updated to indicate that OS has been upgraded (or downgraded)
+ """
+ def __init__(self):
+ name = 'PreVersion1.0'
+ version = '1.0'
+ super(PreV1, self).__init__(name, version)
diff --git a/lib/spack/spack/platforms/spack_compatibility.py b/lib/spack/spack/platforms/spack_compatibility.py
new file mode 100644
index 0000000000..86cbfb3044
--- /dev/null
+++ b/lib/spack/spack/platforms/spack_compatibility.py
@@ -0,0 +1,23 @@
+import subprocess
+from spack.architecture import Platform
+from spack.operating_systems.pre_v1
+
+class SpackCompatibility(Platform):
+ priority = 9999
+
+ # We don't use the normal target getters for this platform
+ # Instead, targets are added directly when parsing the yaml
+
+ # OS is the spack backwards compatibility os.
+ front_os = 'PreVersion1.0'
+ back_os = 'PreVersion1.0'
+ default_os = 'PreVersion1.0'
+
+ def __init__(self):
+ super(SpackCompatibility, self).__init__('spack_compatibility')
+ sc_os = spack.operating_systems.pre_v1.PreV1()
+ self.add_operating_system(sc_os.name, sc_os)
+
+ @classmethod
+ def detect(self):
+ return True