cleaned up concretize architecture
This commit is contained in:
parent
b591d2b501
commit
4601c36f57
1 changed files with 64 additions and 27 deletions
|
@ -218,20 +218,55 @@ def _concretize_platform(self, arch, platform):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _concretize_operating_system(self, arch, platform):
|
def _concretize_operating_system(self, arch, platform):
|
||||||
""" Future method for concretizing operating system """
|
if spec.architecture.platform_os is not None:
|
||||||
if isinstance(arch.platform_os, spack.architecture.OperatingSystem):
|
if isinstance(spec.architecture.platform_os,spack.architecture.OperatingSystem):
|
||||||
return False
|
return False
|
||||||
|
else:
|
||||||
|
spec.add_operating_system_from_string(spec.architecture.platform_os)
|
||||||
|
return True #changed
|
||||||
|
if spec.root.architecture.platform_os:
|
||||||
|
if isinstance(spec.root.architecture.platform_os,spack.architecture.OperatingSystem):
|
||||||
|
spec.architecture.platform_os = spec.root.architecture.platform_os
|
||||||
|
else:
|
||||||
|
spec.add_operating_system_from_string(spec.root.architecture.platform_os)
|
||||||
else:
|
else:
|
||||||
arch.arch_os = platform.operating_system('default_os')
|
platform = spack.architecture.sys_type()
|
||||||
return True
|
spec.architecture.platform_os = platform.operating_system('default_os')
|
||||||
|
|
||||||
|
return True #changed
|
||||||
|
|
||||||
|
# """ Future method for concretizing operating system """
|
||||||
|
# if isinstance(arch.platform_os, spack.architecture.OperatingSystem):
|
||||||
|
# return False
|
||||||
|
# else:
|
||||||
|
# arch.arch_os = platform.operating_system('default_os')
|
||||||
|
# return True
|
||||||
|
|
||||||
|
|
||||||
def _concretize_target(self, arch, platform):
|
def _concretize_target(self, arch, platform):
|
||||||
if isinstance(arch.target, spack.architecture.Target):
|
if spec.target is not None:
|
||||||
return False
|
if isinstance(spec.target,spack.architecture.Target):
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
spec.add_target_from_string(spec.target)
|
||||||
|
return True #changed
|
||||||
|
|
||||||
|
if spec.root.target:
|
||||||
|
if isinstance(spec.root.target,spack.architecture.Target):
|
||||||
|
spec.target = spec.root.target
|
||||||
|
else:
|
||||||
|
spec.add_target_from_string(spec.root.target)
|
||||||
else:
|
else:
|
||||||
arch.target = platform.target('default')
|
platform = spack.architecture.sys_type()
|
||||||
return True
|
spec.target = platform.target('default')
|
||||||
|
|
||||||
|
return True #changed
|
||||||
|
|
||||||
|
# if isinstance(arch.target, spack.architecture.Target):
|
||||||
|
# return False
|
||||||
|
# else:
|
||||||
|
# arch.target = platform.target('default')
|
||||||
|
# return True
|
||||||
|
|
||||||
def concretize_architecture(self, spec):
|
def concretize_architecture(self, spec):
|
||||||
"""If the spec is empty provide the defaults of the platform. If the
|
"""If the spec is empty provide the defaults of the platform. If the
|
||||||
|
@ -251,33 +286,35 @@ def concretize_architecture(self, spec):
|
||||||
Arch = spack.architecture.Arch
|
Arch = spack.architecture.Arch
|
||||||
# Set the architecture to all defaults
|
# Set the architecture to all defaults
|
||||||
spec.architecture = Arch(platform=platform,
|
spec.architecture = Arch(platform=platform,
|
||||||
platform_os=platform.operating_system('default_os'),
|
None,
|
||||||
target=platform.target('default'))
|
None)
|
||||||
return True
|
return True
|
||||||
#If there is a target and it is a tuple and has both filled return
|
#If there is a target and it is a tuple and has both filled return
|
||||||
#False
|
#False
|
||||||
if not isinstance(spec.architecture, basestring):
|
# if isinstance(spec.architecture, basestring):
|
||||||
return any((
|
# spec.split_architecture_string(spec.architecture)
|
||||||
|
|
||||||
|
|
||||||
|
ret = any((
|
||||||
self._concretize_platform(spec.architecture, platform),
|
self._concretize_platform(spec.architecture, platform),
|
||||||
self._concretize_operating_system(spec.architecture, platform),
|
self._concretize_operating_system(spec.architecture, platform),
|
||||||
self._concretize_target(spec.architecture, platform)))
|
self._concretize_target(spec.architecture, platform)))
|
||||||
else:
|
|
||||||
spec.add_architecture_from_string(spec.architecture)
|
|
||||||
|
|
||||||
# Does not look pretty at all!!!
|
# Does not look pretty at all!!!
|
||||||
if spec.root.architecture and \
|
# if spec.root.architecture and \
|
||||||
not isinstance(spec.root.architecture, basestring):
|
# not isinstance(spec.root.architecture, basestring):
|
||||||
bool_flag = any((
|
# bool_flag = any((
|
||||||
self._concretize_platform(spec.root.architecture, platform),
|
# self._concretize_platform(spec.root.architecture, platform),
|
||||||
self._concretize_operating_system(spec.root.architecture,
|
# self._concretize_operating_system(spec.root.architecture,
|
||||||
platform),
|
# platform),
|
||||||
self._concretize_target(spec.root.target, platform)))
|
# self._concretize_target(spec.root.target, platform)))
|
||||||
spec.architecture =spec.root.architecture
|
# spec.architecture =spec.root.architecture
|
||||||
return bool_flag
|
# return bool_flag
|
||||||
else:
|
# else:
|
||||||
spec.add_architecture_from_string(spec.root.architecture)
|
# spec.add_architecture_from_string(spec.root.architecture)
|
||||||
|
|
||||||
return True
|
return ret
|
||||||
|
|
||||||
# if there is no target specified used the defaults
|
# if there is no target specified used the defaults
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue