made yaml format backwards compatible
This commit is contained in:
parent
3b675d8b70
commit
b968603a57
@ -90,7 +90,7 @@
|
|||||||
from spack.util.environment import get_path
|
from spack.util.environment import get_path
|
||||||
from spack.util.multiproc import parmap
|
from spack.util.multiproc import parmap
|
||||||
import spack.error as serr
|
import spack.error as serr
|
||||||
|
import spack.platforms
|
||||||
|
|
||||||
class InvalidSysTypeError(serr.SpackError):
|
class InvalidSysTypeError(serr.SpackError):
|
||||||
def __init__(self, sys_type):
|
def __init__(self, sys_type):
|
||||||
@ -462,18 +462,24 @@ def arch_from_dict(d):
|
|||||||
"""
|
"""
|
||||||
arch = Arch()
|
arch = Arch()
|
||||||
|
|
||||||
|
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:
|
if d is None:
|
||||||
return None
|
return None
|
||||||
platform_dict = d['platform']
|
platform_dict = d['platform']
|
||||||
os_dict = d['platform_os']
|
os_dict = d['platform_os']
|
||||||
target_dict = d['target']
|
target_dict = d['target']
|
||||||
|
|
||||||
platform = _platform_from_dict(platform_dict) if platform_dict else None
|
arch.platform = _platform_from_dict(platform_dict) if platform_dict else None
|
||||||
target = _target_from_dict(target_dict) if os_dict else None
|
arch.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_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.os_string = None
|
||||||
arch.target_string = None
|
arch.target_string = None
|
||||||
|
17
lib/spack/spack/operating_systems/pre_v1.py
Normal file
17
lib/spack/spack/operating_systems/pre_v1.py
Normal file
@ -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)
|
23
lib/spack/spack/platforms/spack_compatibility.py
Normal file
23
lib/spack/spack/platforms/spack_compatibility.py
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user